0.1.13 • Published 4 years ago

collectio v0.1.13

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

Collectio

Data storage for microservices. With an interface similar to JavaScript Objects. All data will be stored in dataDir.

import Collectio from 'colletio'

const dataDir = '/path/to/data/dir'

const Users = new Collectio('users', dataDir)

// _ - is record id
// null as id will create record with new id
// you can specify id if record is not presented it will be created
// if record with given id is presented it will be updated 
const rey = Users[null] = { 
    firstName: 'Rey',
    familyName: 'Palpatine'
}

const luke = Users[null] = { 
    firstName: 'Luke',
    familyName: 'Skywalker'
}

Users[rey._] = {
  ...Users[rey._],
  familyName: 'Skywalker'
}

Users.searchSync({
  familyName: 'Skywalker'
}, {
  limit: 2, 
  offset: 0,
  sort: {_: -1, firstName: 1} 
})

delete Users[luke._]
0.1.12

4 years ago

0.1.13

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago