Wednesday, August 27, 2008

More work on the OR-Mapper

just some updates that make the tool actually useful:
  • There is now a remove method in every entity to delete it from the database
  • Transaction support for Gears. Transactions are queued, so you can safely nest them in callbacks but they wont be executed until the current transaction is done (same behavior as with HTML5 databases)
  • A little meta class magic to make Entity definitions even nicer:
This is how entity definitions look now:
           Class("Person", {
isa: ORM.Entity,

tableName: "person",

hasOne: {
mother: {
isa: function () { return m.Person }
}
},

hasMany: {
cars: {
isa: function () { return m.Car },
foreignKey: "owner"
}
}
});

If you are interested in how these DSL like class definitions are
achieved using the Joose framework, this commit might be interesting:
Post a Comment