webmcp
diff libraries/mondelefant/mondelefant.lua @ 376:4bcedf32b089
Allow direct (proxy) access to fields of JSON object in a special column (set in the model) (write access not implemented yet)
author | jbe |
---|---|
date | Sat Nov 14 17:07:03 2015 +0100 (2015-11-14) |
parents | fb98b17056e5 |
children | c343ce9092ee |
line diff
1.1 --- a/libraries/mondelefant/mondelefant.lua Sat Nov 14 15:44:53 2015 +0100 1.2 +++ b/libraries/mondelefant/mondelefant.lua Sat Nov 14 17:07:03 2015 +0100 1.3 @@ -915,11 +915,22 @@ 1.4 1.5 Primary key of a database class (model). Defaults to "id". 1.6 1.7 +If the primary key is a tuple, then a sequence (table with integer keys mapped to the column names) must be used. If the primary key is contained in a JSON document within a table column, then a special object with the following fields is expected: {json_doc = "column_name", key = "field_name_within_json_object", type = "postgresql_type"}. 1.8 + 1.9 --]]-- 1.10 class_prototype.primary_key = "id" 1.11 --//-- 1.12 1.13 --[[-- 1.14 +<db_class>.document_column 1.15 + 1.16 +Optional column name to redirect key lookups to. This can be used to allow for an easier access to fields of a JSON document. 1.17 + 1.18 +--]]-- 1.19 +class_prototype.document_column = nil 1.20 +--//-- 1.21 + 1.22 +--[[-- 1.23 db_handle = -- database connection handle used by this class 1.24 <db_class>:get_db_conn() 1.25