darthapo / dm.js

DM.js is a simple JavaScript ORM (loosely based on ActiveRecord) that supports the following sqlite browser backends: Safari/HTML5, Adobe Air, and Google Gears.

This URL has Read+Write access

dm.js / Notes.taskpaper
100644 13 lines (10 sloc) 0.611 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
Todo:
- Add relationships:
- hasMany
- belongsTo
- hasOne
- hasAndBelongsToMany
- WHERE clause builder
- t.serialize('column_name') -> Serializes to/from JSON???
 
 
Thoughts and/or Ideas:
Perhaps ActiveRecord really isn't the model to pursue with this framework. The fact that the HTML5 data storage api is pervasively asynchronous makes some of AR's methods difficult at best. For example Model.count() really shouldn' require a callback, but it does. Maybe it'd be better to use a map/reduce pattern. You could chain calls to filter(), order(), sort() -- whatever. Then use an each() to run the SQL. @idea