fh-db Collection
Simple wrapper around the $fh.db API to allow the creation of Models to represent data objects.
Example Usage
Create a Collection wrapper.
var Collection = util = ; { Collection;}util; Peopleprototype { // Do something!}; moduleexports = 'people';
Use it with the inherited methods!
var People = ; People;
Class Functions
Any class that inherits from this receives the following functions. Which correspond to $fh.db functions.
- create (data, callback)
- update (guid, data, callback)
- read (guid, callback)
- remove (guid, callback)
- truncate (callback)
- find ([opts,] callback)
- findOne ([opts,] callback)
- findBy (property, value, callback)
Contributing
We could make this module more flexible to support models etc so you could do the following:
// Item.js inherits from our Model classvar Item = ; var i = type: 'car' condition: 'great'; i;