1.0.1 • Published 7 years ago

pistache v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago
const pistache = require('pistache')

// you pass it the directory name, and a list of index keys
// index keys must be unique, the first will be used as the primary key
const users = pistache('user', [ 'id', 'mail' ])

users.set({
  id: 5,
  firstname: 'jeano',
  lastname: 'pernault',
  mail: 'jpernault@gmail.com',
})

const userJeano = users.get(5)
const userJeanoFromMail = users.get.mail('jpernault@gmail.com')

// write job is delayed in a save loop to allow user to freely spam
// the synchronous api without worrying about it affecting the performances

// All writes are atomics, the primary key is used as file name.