Pages

Definition

Objects and abstractions

Syntax

Settings and modifiers

Blog

Motivation

Use cases and requirements

Cheat sheets

Quick reference

Screw long documentation, I’ll learn by example

Settings and modifiers

Database modifiers

  • [partition] informs that this field is a partition key. Rows with the same values will end up in the same node.

  • [key] flags fields that constitute table’s primary key.

  • [unique] says that values in that field is unique for each object

  • index[<index_name>: <range|equal|...>] says that this field is a part of index <index_name>, and in that index it can be effectively queried using “equals”, “not equals” and “in” (equal) or using “>” and “<” or “between” (range). Custom index types are supported; for example, to define database-specific index (such as fulltext-search indices).

Validation modifiers

  • subset[P], superset[P], all[P], where P is a reference be another schema’s field. subset, superset say that the set of all values of field at hand is a subset/superset of P. all means that for each value of P there is a corresponding record in the schema at hand.
    • Example: a map which contains some Transaction id’s as a key:
    • prices:Map[Transaction.id, int] subset[p.keys, Transaction.id]
  • always[a > 0] or just [a > 0] or [>0] states domain on valid ranges.

  • typically[a > 0, a <100] or [a >~ 0, a <~100] or [>~ 0, <~100] define typical domain. “~” is a shorthand of “typically” here. It is useful (for sharding, for example) to know the real range and whether the field is dominated by a single value: typically[a = null]

  • if[a > 0] then[x = 5] else[x = 3] and if[a > 0] then[y > ~5] are conditional domain specification.

  • defined[field1, field...], md5[...] to inform that this field is functionally dependent on other fields

  • substring[..4, = "test"] to substring

Semantics and formats

  • same[W] and similar[W] states that this field has same/similar semantic meaning as W.

  • utctime["timesamp"/"iso"/formatstring] specifies time format of the field (UTC)

  • zonetime[time: "timestamp"iso"/formatstring, zone: TIMEZONE] specifies time format of the field along with timezone. Useful for keeping client’s time. TIMEZONE is an ISO string that represents a timezone.

  • unit[UNITNAME] or unit[UNITNAME / 1000] defines property’s unit. It is useful when some fields deal with one unit (milliseconds, dollars, bytes) and some have other (seconds, cents, kilobytes).

  • default[VALUE] defines default value of the field. It is used when field is omitted during deserialization.

  • format[FORMAT] to assure format inside this string. a: str format[json] can be rewritten canonically into a: str.json or a: json.

  • lag[t], lag[t1..t2], since[t]

  • first[t>...], last[t<...]

  • first since[], last before[t]

Data streams

  • stream[x] or just x is an infinite sequence of objects of type X; and we are looking at objects one by one. stream[X@t2]@t means that now, at moment t, an object state was read from the stream. This state was captured at moment t2 (and t2<t)

  • batch[x]@t1..t2 or batch[x]#N is a finite sequence of objects, drawn from an infinite set. We are looking at all objects in the batch simultaneously. We can specify time range of objects in the batch, or number of records.

  • one[x] or single[x] means that there is a single x is passed, drawn from a finite set (for example, config file, or credentials of available nodes).

Access modifiers

[external] - defined here, but you do not control that

[public] - default; exposed to everyone who can read the doc

[private] - invisible to all who can read the doc.