Skip to content

Types

Types in Onyx define the various categories of data which can be stored.

Each field belongs to a certain type. This dictates what kind of data the field can store (e.g. text, numbers, dates, etc.), as well as what filter operations (i.e. lookups) can be carried out on values of the field.

text

[exact] [ne] [in] [notin] [contains] [startswith] [endswith] [iexact] [icontains] [istartswith] [iendswith] [length] [length__in] [length__range] [isnull]

A string of characters.

Examples: "C-1234567890", "Details about something"

choice

[exact] [ne] [in] [notin] [isnull]

A restricted set of options.

Examples: "ENG", "WALES", "SCOT", "NI"

integer

[exact] [ne] [in] [notin] [lt] [lte] [gt] [gte] [range] [isnull]

A whole number.

Examples: 1, -1, 123

decimal

[exact] [ne] [in] [notin] [lt] [lte] [gt] [gte] [range] [isnull]

A decimal number.

Examples: 1.234, 1.0, 23.456

date

[exact] [ne] [in] [notin] [lt] [lte] [gt] [gte] [range] [iso_year] [iso_year__in] [iso_year__range] [week] [week__in] [week__range] [isnull]

A date.

Examples: "2023-03", "2023-04-05", "2024-01-01"

datetime

[exact] [ne] [in] [notin] [lt] [lte] [gt] [gte] [range] [iso_year] [iso_year__in] [iso_year__range] [week] [week__in] [week__range] [isnull]

A date and time.

Examples: "2023-01-01 15:30:03", "2024-01-01 09:30:17"

bool

[exact] [ne] [in] [notin] [isnull]

A true or false value.

Examples: True, False

relation

[isnull]

A link to a row, or multiple rows, in another table.

array

[exact] [contains] [contained_by] [overlap] [length] [length__in] [length__range] [isnull]

A list of values.

Examples: [1, 2, 3], ["hello", "world", "!"]

structure

[exact] [contains] [contained_by] [has_key] [has_keys] [has_any_keys] [isnull]

An arbitrary JSON structure.

Examples: {"hello" : "world", "goodbye" : "!"}, {"numbers" : [1, 2, {"more_numbers" : [3, 4, 5]}]}