Monday, July 16th, 2007
Google Gears ORM 0.1
Uriel Katz has a first official release of Google Gears ORM. One of the common questions that I see out there is "will there be ActiveRecord for local databases?". This is far from that promise, but it is a glimpse into the path.
This new version brings a lot of new features including:
- Relations between models including ManyToOne,OneToMany and ManyToMany(with automatic creation of m2m tables)
- Easy loading from JSON response.
- Real enforcing of foreign keys(in update,delete and insert),using triggers(supporting "on delete cascade" and "on delete restrict" - default).
- Easy iterating with each syntax like in Ruby.
Some sample usage
-
-
// Creating a model
-
var Tag = new GearsORM.Model({ name:"Tag", fields: {
-
name: new GearsORM.Fields.String({maxLength:25}),
-
posts: new GearsORM.Fields.ManyToMany({related:"Post"})
-
} });
-
-
// Making sure the table exists
-
Tag.createTable();
-
-
// Creating entities with relationships
-
var myTestPost = new Post({ title:"my test post", body:"my test post body" }).save();
-
myTestPost.tags.add(testTag);
-












Oooh very nice.
Gears dev will be really accelerateв with this tool
Great Job! I think this guy must to place the GearsORM project at Google Code.
Very exciting to see this. Many thanks.
I’d like to get a look at the unpacked source? As far as I can see, it’s not on the trac site, nor on Uriel’s blog. I love what you presented in your example, but this is something I’d really like to get familiarity with, and since there is no documentation up yet, it would be nice to be able to look at the unpacked source to see what additional methods, etc are there with your ORM.
Thanks again and cheers-
the source code is on the trac site here(this is only to for viewing):
http://labs.urielkatz.com/browser/GearsORM/trunk/
i will add a link to the svn once i setup it on apache.
@tio:why should i put it on Google Code,i don`t think google code is as good as Trac.
you can see it here:
http://labs.urielkatz.com/wiki/GearsORM/
many thanks, Uriel-
cheers,
Mark