Simple ORM HTML5

Simple ORM is a LGPL ORM (Object-Relational Mapping) for JavaScript/HTML5. It’s a middleware over Web SQL.

It was designed to be simple. To define a new model, all you need is to create a new class like that:


function Client(orm){
this.base = ModelBase;
this.base("client");
this.fields = ["snName","iWeight","dnBorn"];
this.init(orm);
}

The most important line of the code above is «this.fields = […]«. Here, we define the fields of our model.
The syntax is pretty simple.

<type><flags><Name-of-field-first-letter-uppercase>.

So that, «snName» defines the field «name» as a not null string.

Automatically, Simple ORM creates the table (if not exists) and binds properties to the objects for access to data.

The project is hosted at Google Code: Simple ORM HTML5

Deja un comentario