documentation: fix data types table formatting

This commit is contained in:
Jordi Gutiérrez Hermoso 2024-07-29 09:55:16 -04:00 committed by jordigh
parent fea7c0b536
commit db26f3be6a

View File

@ -124,28 +124,32 @@ Note that this combination of rules allows tables and column names to be valid i
## Value Types ## Value Types
> [!WARNING]
> This section is out of date.
The format supports a number of data types. Some types have a short representation (e.g. `Numeric` as a JSON `number`, and `Text` as a JSON `string`), but all types have an explicit representation as well. The format supports a number of data types. Some types have a short representation (e.g. `Numeric` as a JSON `number`, and `Text` as a JSON `string`), but all types have an explicit representation as well.
The explicit representation of a value is an array `[typeCode, args...]`. The first member of the array is a string code that defines the type of the value. The rest of the elements are arguments used to construct the actual value. The explicit representation of a value is an array `[typeCode, args...]`. The first member of the array is a string code that defines the type of the value. The rest of the elements are arguments used to construct the actual value.
The following table lists currently supported types and their short and explicit representations. The following table lists currently supported types and their short and explicit representations.
| **Type Name** | **Short Repr** | **[Type Code, Args...]** | **Description** | | **Type Name** | **Short Repr** | **[Type Code, Args...]** | **Description** |
| `Numeric` | `number`* | `['n',number]` | double-precision floating point number | |------------------|----------------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `Text` | `string`* | `['s',string]` | Unicode string | | `Numeric` | `number`* | `['n',number]` | double-precision floating point number |
| `Bool` | `bool`* | `['b',bool]` | Boolean value (true or false) | | `Text` | `string`* | `['s',string]` | Unicode string |
| `Null` | `null`* | `null` | Null value (no special explicit representation) | | `Bool` | `bool`* | `['b',bool]` | Boolean value (true or false) |
| `Int` | `number` | `['i',number]` | 32-bit integer | | `Null` | `null`* | `null` | Null value (no special explicit representation) |
| `Date` | `number` | `['d',number]` | Calendar date, represented as seconds since Epoch to 00:00 UTC on that date. | | `Int` | `number` | `['i',number]` | 32-bit integer |
| `DateTime` | `number` | `['D',number]` | Instance in time, represented as seconds since Epoch | | `Date` | `number` | `['d',number]` | Calendar date, represented as seconds since Epoch to 00:00 UTC on that date. |
| `Reference` | `number` | `['R',number]` | Identifier of a record in a table. | | `DateTime` | `number` | `['D',number]` | Instance in time, represented as seconds since Epoch |
| `ReferenceList` | | `['L',number,...]` | List of record identifiers | | `Reference` | `number` | `['R',number]` | Identifier of a record in a table. |
| `Choice` | `string` | `['C',string]` | Unicode string selected from a list of choices. | | `ReferenceList` | | `['L',number,...]` | List of record identifiers |
| `PositionNumber` | `number` | `['P',number]` | a double used to order records relative to each other. | | `Choice` | `string` | `['C',string]` | Unicode string selected from a list of choices. |
| `Image` | | `['I',string]` | Binary data representing an image, encoded as base64 | | `PositionNumber` | `number` | `['P',number]` | a double used to order records relative to each other. |
| `List` | | `['l',values,...]` | List of values of any type. | | `Image` | | `['I',string]` | Binary data representing an image, encoded as base64 |
| `JSON` | | `['J',object]` | JSON-serializable object | | `List` | | `['l',values,...]` | List of values of any type. |
| `Error` | | `['E',string,string?,value?]` | Exception, with first argument exception type, second an optional message, and optionally a third containing additional info. | | `JSON` | | `['J',object]` | JSON-serializable object |
| `Error` | | `['E',string,string?,value?]` | Exception, with first argument exception type, second an optional message, and optionally a third containing additional info. |
An important goal is to represent data efficiently in the common case. When a value matches the column's type, the short representation is used. For example, in a Numeric column, a Numeric value is represented as a `number`, and in a Date column, a Date value is represented as a `number`. An important goal is to represent data efficiently in the common case. When a value matches the column's type, the short representation is used. For example, in a Numeric column, a Numeric value is represented as a `number`, and in a Date column, a Date value is represented as a `number`.