Tubbs
Tubbs is Data Model Layer which makes working with your data much easier.
Features
- ActiveModel-style validation
- Observe property value changes
- Observe deletion and save
- Abstract data store interface. So far:
- In-memory (built-in:
Tubbs.MemoryStore
) - Riak (via tubbs-riakstorage - server-side only at the moment)
- REST (via rubbs-reststorage - browser-only, at the moment)
- In-memory (built-in:
Examples
{ this;} ; Object;
Create a new user
var user = username: "kbacon" first: "Kevin" last: "Bacon";
Get one of its virtual properties
console;// -> 'Kevin Bacon'
Observe property value changes
User; User; var user = ; user; user;
Observe model creation and deletion and save
User; User; var user = ; user; user;
Serialize the instance to pure JSON
console;// ->// {// "username": "kbacon",// "first": "Kevin",// "last": "Bacon"// }
Roadmap (Also, see TODO.md)
- Validation
allowBlank
option?- shortcut format validator strings, such as "email" and "phone"
- Add a
beforeSave
option: beforeSave: function() { this.dateModified = new Date(); } - Figure out how to notify others when an error is thrown.
- More unit test coverage
- Schema-based generated class methods: Person.findAllByAge(50, cb)
- Documentation Pages
- Model instance API
- Model class API
- Validators
- CouchStore
- MongoStore
- RedisStore
- LocalStorageStore