valum-framework / valum

Web micro-framework written in Vala
https://valum-framework.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
226 stars 23 forks source link

Use GLib.Parameter[] to store request params #111

Closed arteymix closed 8 years ago

arteymix commented 9 years ago

The request paramters can integrate better with GObject if they consist of a list of GLib.Parameter. At first, it will be possible to unpack them in an arbitrary object and access the parameters by properties.

var obj = Object.newv (request.params);

var id = obj.property;

Then we could rework the current type system for parameters so that it can expand automatically the desired type.

var id = req.params[0].value.get_int ();

We could also use Variant serialization to store and extract data: http://valadoc.org/#!api=glib-2.0/GLib.Variant

arteymix commented 9 years ago

After thoughts, this PR should be reoriented as follow:

Also, it does not appear to be possible to store GLib.Parameter in Value, which makes it impossible to push them on the routing stack.

arteymix commented 9 years ago

It's possible to register type transformation functions that would convert from our types to target types: http://valadoc.org/#!api=gobject-2.0/GLib.Value.register_transform_func

Types in parameters would just become GType identifiers and extraction/marshalling would just become type transformations.

arteymix commented 8 years ago

Parameters will be stored in the context.