Monday, July 16th, 2007

Google Gears ORM 0.1

Category: Gears, Google, JavaScript, Library

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

javascript

  1. // Creating a model
  2. var Tag = new GearsORM.Model({ name:"Tag", fields: {
  3.   name:  new GearsORM.Fields.String({maxLength:25}),
  4.   posts: new GearsORM.Fields.ManyToMany({related:"Post"})
  5. } });
  6.  
  7. // Making sure the table exists
  8. Tag.createTable();
  9.  
  10. // Creating entities with relationships
  11. var myTestPost = new Post({ title:"my test post", body:"my test post body" }).save();
  12. myTestPost.tags.add(testTag);

Posted by Dion Almaer at 12:39 am
6 Comments

+++--
3.6 rating from 32 votes

6 Comments »

Comments feed TrackBack URI

Oooh very nice.

Comment by Dr Nic — July 16, 2007

Gears dev will be really accelerateв with this tool

Comment by Oleg — July 16, 2007

Great Job! I think this guy must to place the GearsORM project at Google Code.

Comment by Tio Malandra — July 16, 2007

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-

Comment by Mark Holton — July 16, 2007

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/

Comment by Uriel Katz — July 16, 2007

many thanks, Uriel-
cheers,
Mark

Comment by Mark Holton — July 16, 2007

Leave a comment

You must be logged in to post a comment.