DataMapper for GObject

I've become envious of various web frameworks ability to access data with ease. It's become so easy to lookup, manipulate, and persist data objects that developers can focus more of their energy on user-interaction.

In the hopes that it will become like this for desktop applications, I started putting together a simple data-mapper for GObject. It is incredibly basic in its current state, but I intend to add features out of my own needs.

Only a simplistic Sqlite backend is currently implemented; but the idea is to support numerous data sources such as json, yaml, and libgda.

It's written in Vala and consumption looks something like the following.

1 Person.find ().each (obj => {
2     debug ("%s", ((Person)obj).name);
3 });

After a little more effort, the following should also be supported.

1 var last_name = Person.find (
2     Condition.str_equal ("name", "Christian").and (
3     Condition.int_gt ("age", 18))
4 ).first ().last_name;

That will be simplified more when Vala bug #528436 is fixed. Fixing this bug will allow for automatic boxing/unboxing of variables into GValue's. That means you will not need to use Condition.str_equal, but Condition.equal instead.

Source: git:// Licensed: LGPL-3

-- Christian Hergert 2008-07-09

Back to Index