BasicType

class tracdap.metadata.BasicType

Bases: enum.Enum

Basic types provide the set of core types available in the TRAC type system.

ARRAY = 8

An array of values, which may be primitive or composite values.

All items in an array must have the same type (i.e. the same type descriptor).

BASIC_TYPE_NOT_SET = 0
BOOLEAN = 1

A true/false value

DATE = 6

A date value.

Dates do not take any account of time zones or offsets from UTC.

DATETIME = 7

A date-time value.

Date-time values may be expressed with an offset from UTC, as per ISO 8601. The available sub-second precision may vary depending on language / platform.

For metadata attributes, TRAC represents all date-times as in UTC with microsecond precision. Incoming values will be converted to UTC if they are supplied with an offset.

DECIMAL = 5

A fixed-point decimal value with known precision and scale.

The available precision and scale may vary between languages / platforms.

For metadata attributes, TRAC provides the following guarantees on precision:

  • precision >= 31

  • scale >= 10

  • precision - scale >= 21

FLOAT = 3

64 bit signed floating point number (referred to as ‘double’ in many languages)

INTEGER = 2

64 bit signed integer

MAP = 9

An key-value map with string keys, values may be primitive or composite values.

Maps may be uniform, in which case all the values are of the same type, or non- uniform in which case values can be of any type. For uniform maps the type descriptor will specify the type contained in the map. For non-uniform maps the type descriptor can only specify that the map is non-uniform, values must be examined at run time to determine their type.

See also

TypeDescriptor

STRING = 4

UTF encoded string value of arbitrary length.

The encoding used (e.g. UTF-8, UTF-16, UCS-16) varies between languages / platforms, generally TRAC will present strings using the standard encoding for a given language or protocol.