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

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: