Skip to content

Tilda Type System

Laurent Hasson edited this page Jan 4, 2023 · 7 revisions

<-- Object Columns

<-- Short Expressions

The Tilda Type System

Many elements in the Tilda definition json syntax can define a type that will be translated to the appropriate type in the database. For example, columns in a table, or view columns that are modified with a short expression.

  • type: A type for the column where values can be:

    • STRING: a string value
      • String values must also define a “size” attribute with a value > 1. The framework typically implements a threshold depending on the database to decide whether to store a CHAR or VARCHAR column. In Postgres, that threshold is 8, i.e., STRINGs less than 8 characters long are stores as char(n), whereas STRINGs 8 character or more are stored as VARCHAR(n). In SQLServer, that threshold is 20. At this time, this is not changeable.
      • Alternatively from defining "type":"STRING" and "size":100, you can also define the size directly in the type definition as "type":"STRING(100)".
    • JSON: a JSON data structure (which may be stored as a text field in databases that do not support native JSON storage
    • CHAR: a single character
    • SHORT: a 16-bit integer
    • INTEGER: a 32-bit integer
    • LONG: a 64-bit integer
    • FLOAT: a 32-bit floating point value
    • DOUBLE: a 64-bit floating point value
    • NUMERIC: an arbitrarily sized floating point value (BigDecimal implementation in Java)
    • BOOLEAN: a Boolean value (which may be stored as an short with the values 0/1 in databases that do not support Boolean values)
    • DATE: a date
    • DATETIME: a date and time, with timezone if supported by the DB
    • BINARY: a binary object
    • BITFIELD: up to 64 bit values
    • UUID: a 128-bit value, universally unique identifier

    Columns can also be defined as collections by appending to the type name “[]” for arrays/lists (sequential values), and “{}” for sets (i.e., unique values, non-sequential).

    • For databases that don’t support arrays, a comma-separated list of values in a text field is used and serialization/deserialization is done in the generated Java code. Any database-level logic (ETL or stored procedures and so on) must implement support appropriately by using stock Tilda functions.
    • For sets, as far as we know, no database support them natively as column types. As such, the “deduping” (removing duplicates), is performed in the generated application code at serialization/deserialization time. Any database-level logic (ETL or stored procedures and so on) must implement support appropriately by using stock Tilda functions.
Clone this wiki locally