A JS ORM for TideSDK
To run the tests you need to create a TideSDK app and run them inside with a Jasmine HTML spec runner.
var dbaccess = Ti.Database.open('test');
var usersSchema = {name: 'TEXT', surname: 'TEXT', age: 'INTEGER'}
var usersModel = timodel('users', usersSchema, dbaccess);
usersModel.createTable();
//creates and returns the element
var john = usersModel.create({name: 'John', surname: 'sanders', age: 23});
john.id // 1;
john.age = 24;
john = usersModel.update(john);
john.age //24;
usersModel.create({name: 'John', surname: 'Smith', age: 23});
usersModel.create({name: 'Marta', surname: 'Smith', age: 24});
usersModel.create({name: 'Louis', surname: 'Peti', age: 26});
var users = usersModel.find({surname: 'Smith'});
users // [{id: 1, name: 'John', surname: 'Smith', age: 23}, {id: 2, name: 'Marta', surname: 'Smith', age: 24}];
/// If you dont pass a filter, it returns all the elements.
usersModel.remove(2); // deletes the element with id = 2