model.anubis 1.29 KB
/*
 * Created by PyramIDE.
 * User: フランスのトトロ aka (David RENÉ) 
 * Date: 13/02/2016
 * Time: 10:41
 * © David RENÉ
 */

transmit tools/basis.anubis
transmit columns.anubis
transmit calexium_lib/web/CXM_json.anubis
transmit hayamiki_lib/model/types/hk_model.anubis

public define HK_Model
  hk_model(
    List(HK_Model_Column)  columns,           //columns other than the primary key column (if any)
    String                 show_string        
  )=
  hk_model(columns, [], show_string)
.

  _HK_MODEL message format:
  ========================
  
  +------------+---------------+--------------------------
  |  name      |  type         |      description
  +------------+---------------+--------------------------------
  | "columns"  | List(Message) | List of columns of the table Message id is _HK_COLUMN
  | "show_str" | String        | computation String to be shown to summarize row content. This string is Anubis source code
                                 where the row content is in datum, named "obj".
   
public define JsonValue
  to_JSON
  (
    HK_Model hk_model
  )=
  json_object("_HK_MODEL",
  [
    json_member("columns",   json_array(map((HK_Model_Column column) |-> to_JSON(column), hk_model.columns))),
    json_member("show_str",  json_string(hk_model.show_string))
  ]).