Types
Adama has many built-in primal types! The following tables outline which types are available.
type | contents | default | fun example |
---|---|---|---|
bool | bool can have one of the two values true or false. | false | true |
int | int is a signed integer number that uses 32-bits. This results in valid values between −2,147,483,648 and 2,147,483,647. | 0 | 42 |
long | long is a signed integer number that uses 64-bits. This results in valid values between -9,223,372,036,854,775,808 and +9,223,372,036,854,775,807. | 0 | 42 |
double | double is a floating-point type which uses 64-bit IEEE754. This results in a range of 1.7E +/- 308 (15 digits). | 0.0 | 3.15 |
complex | complex is a tuple of two doubles under the complex field of numbers | 0 + 0 * @i | @i |
string | string is a utf-8 encoded collection of code-points. | "" (empty string) | "Hello World" |
label | label is a pointer to a block of code which is used by the state machine, | # (the no-state) | #hello |
principal | principal is a reference to a connected person, and the backing data establishes who they are. This is used for acquiring data and decisions from people, | @no_one | @no_one |
dynamic | a blob of JSON | @null | @null |
Call-out to other types
The above built-in types are building blocks for richer types, and the below table provides callouts to other type mechanisms. Not all types are valid at the document level.
Type | Quick call out | Applicable to document/record |
---|---|---|
assets | An asset is an externally stored byte blob | yes |
enum | An enumeration is a type that consists of a finite set of named constants. | yes |
messages | A message is a collection of variables grouped under one name used for communication via channels. | only via a formula |
records | A record is a collection of variables grouped under one name used for persistence. | yes |
maybe | Sometimes things didn't or can't happen, and we use maybe to express that absence rather than null. Monads for the win! | yes (only for applicable types) |
table | A table forms the ultimate collection enabling maps, lists, sets, and more. Tables use records to persist information in a structured way. | yes |
channel | Channels enable communication between the document and people via handlers and futures. | only root document |
future | A future is a result that will arrive in the future. | no |
maps | A map enables associating keys to values, but they can also be the result of a reduction. | yes |
lists | A list is created by using language integrated query on a table | yes |
arrays | An array is a read-only finite collection of a adjacent items | only via a formula |
result | A result is the ongoing progress of a service call made to a remote service | only via a formula |
service | A service is a way to reach beyond the document to a remote resources | only root document |