Commit Graph

8 Commits

Author SHA1 Message Date
Gibheer 1696b6e15e ignore unmapped values
When a name is not mapped then the field should not be updated. This is
a bit weird and maybe should throw an error, but at least we avoid
chaning columns that are not meant to be changed.
2021-05-21 20:54:44 +02:00
Gibheer e9135c9c10 add missing table name
The table name was missing from the implementation of FieldsToJSON.
This was also fixed in the tests.
2021-05-07 21:17:13 +02:00
Gibheer 88c271667b add function FieldsToJSON
This function enables the show view to be much less write overhead.
By defining which columns to return and automatically merging the
attributes into the main view, this can be made so much easier.

It doesn't support the recursive view for now, so that is something a
client would need to handle, but for now this should be good enough.

This also fixes a small issue in the update clause handler by moving
the index handler into the handler when a column was found.
If that was not done, the index gets moved to the wrong position and the
resulting query would be wrongly indexed.
2021-05-07 21:03:58 +02:00
Gibheer f96f8ba4ed fix jsonb output generator
When selecting content of a jsonb field the type per default is jsonb.
But we need to proper posgres type, so that the output can be parsed
properly.
Therefore make sure that the field has the proper output operator
attached.
2021-05-07 11:35:48 +02:00
Gibheer 01b87332d9 add a way to set attributes
For this to work, I have added a new function that takes a list of
key looking things and converts them into json.
At the same time, it also can convert json looking payloads and
prepare it for the database (that last part was not intended, but
works).

With the many columns where setting attributes is possible, this
functionality should help quite a bit.
2021-05-07 10:17:05 +02:00
Gibheer 0f42d2b9ed fix query tests
After the query API was a bit adjusted, the tests weren't fixed.
2021-05-03 21:14:08 +02:00
Gibheer 9e6a6fbe28 define a base table for attributes
When extra fields are fetched from the attributes column it must be
specified from which table that should be. If not done and another table
also has an attribute column, it will end in an error.
2021-05-03 19:41:28 +02:00
Gibheer ee5acc6ded add query interface
This is a small library to build queries and put the result into the
world.
Currently it supports building the select clause and converting rows
into a list of maps, so that it can be returned as a list.
2021-04-28 21:05:31 +02:00