Data types
FQL uses an enhanced Javascript Object Notation (JSON) format for storing and communicating data. JSON is a human and machine-readable open standard that facilitates data interchange. All of JSON’s basic types are supported, including numbers, strings, boolean values, as well as arrays and objects.
Basic types
Type | Description |
---|---|
The boolean data type can only store
|
|
Null is a special marker used to indicate that a data value does not exist. It is a representation of missing information, indicating a lack of a value. A lack of a value is not the same thing as a value of zero, in the same way that a lack of an answer is not the same thing as an answer of "no". Null is a value that can be directly compared for application programmer
simplicity. This means that
|
|
Numbers are any real number which are bounded by the double precision
range (64-bit), such as 3, -27, 3.1415. Neither |
|
String data types store any letters, numbers, whitespaces, and/or symbols in a fixed order. FQL accepts and communicates strings as UTF-8 encoded strings. For string functions, any arguments or returned values which utilize offsets and lengths operate using code points. |
|
An Array is a data structure that contains a group of elements. When an Array is used in FQL, it evaluates to its contents.
|
|
The Object type represents a JSON-like object, where its values are a collection of key/value pairs. The keys must be strings and the values must be valid FQL data types. The value expressions are evaluated sequentially in the order that they were specified, left to right. Objects evaluate to their contents:
|
Special types
In addition to the basic types, FQL supports the following types beyond those native to JSON:
Type | Description |
---|---|
The Bytes type denotes a Base64-encoded string representing a byte array.
|
|
The Date type denotes a date, with no associated time zone.
|
|
The Query type denotes a query expression object. |
|
The Ref type denotes a resource reference. Refs may be extracted from
documents, or constructed using the
|
|
The Set type denotes a set identifier. A set is a group of tuples,
typically representing resources or index
|
|
The Timestamp type (usually written as A Timestamp can safely store nanosecond precision, but be careful as many operating system clocks provide only microsecond precision. Timestamps may be inserted with offsets, but are converted to UTC; the offset component is lost. A Timestamp must be within the range
|
Events
Strictly speaking, events aren’t types; they are objects that capture the temporal history of documents by tracking all create, update, and delete operations over a document’s timeline. However, they have a common structure:
Document events
Field | Value | Description |
---|---|---|
|
The reference to the document. |
|
|
Either "create","update" or "delete". |
|
|
An integer value representing a UNIX timestamp, with microsecond resolution, at which the event occurred. |
|
|
Varies based on the action. |
Set events
Set events are represented by an object returned when paginating through an index.
Field | Value | Description |
---|---|---|
|
The reference to the document. |
|
|
Either |
|
|
An integer value representing a UNIX timestamp, with microsecond resolution, at which the event occurred. |
|
|
Exactly as defined by the index’s |
Precedence
Types have an order of precedence. When comparing values of different types, they are ranked in the following order, from greatest to least. For example, a double is sorted before an integer because of its type.
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!