Skip to content

fwilkerson/datasist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datasist

An inefficient file based database for prototyping.

Caching

Read operations are cached

Every create, update, patch, and delete will cause a write file

Limited Dependencies

node v6+

uuid v3+

Get started

yarn add datasist  or  npm install --save datasist

// import datasist and tell it which directory to store files
const datasist = require('datasist')('my-data-directory');

// create a user file and return an object that modifies that file
const usersDb = datasist('user');

const user = { first: 'Jane', last: 'Doe' };

// append a record to the user file
usersDb.create(user)
  .then(result => {
    // after saving the record is returned with it's new _id field
    console.log(result._id);
  })
  .catch(e => console.error(e));


// query all records in the user file
usersDb.query()
  .then(users => console.log(users))
  .catch(e => console.error(e));

// query users that match the given predicate
usersDb.query(user => user.last.startsWith('D'))
  .then(users => console.log(users))
  .catch(e => console.error(e));

About

An inefficient file based database

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published