xowiki::Page instproc json_attribute_type (public)
<instance of xowiki::Page> json_attribute_type name
Defined in /var/www/openacs/packages/xowiki/tcl/json-procs.tcl
Resolve an attribute's JSON scalar type from inherited slot metadata and the known types of otherwise untyped built-in parameters.
- Parameters:
- name (required)
- Object attribute name, without a form-field underscore prefix.
- Returns:
- JSON scalar type: number, boolean, or string when unknown.
- Testcases:
- No testcase defined.
Source code: # A presentation-only slot (e.g. Page.creation_user) can mask the # database slot's datatype. Inspect the full inheritance chain. set cl [:info class] foreach owner [list $cl {*}[$cl info heritage]] { set slot ${owner}::slot::$name if {![nsf::is object $slot]} { continue } foreach property {datatype type sqltype} { if {![$slot exists $property]} { continue } switch -- [$slot set $property] { boolean - bool {return boolean} integer - int - int4 - int8 - bigint - smallint - naturalnum - float - double - real - numeric - number {return number} } } } # These built-in parameters have no typed slot declaration. switch -- $name { parent_id {return number} absolute_links - do_substitutions - render_adp {return boolean} } return stringXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)