Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Facts

fact FooCounter[device id]=>{count int}
immutable fact FooUsed[deviceid id]=>{}

A fact definition defines the schema for a fact. The first set of fields between the [] is the key part of the fact, and the second set between {} is the value. Fact names should be unique, and for each fact, the field names must be unique across both the key and the value. The number of values in the key and value sets is implementation-defined.

Fact fields use a more limited set of types because of ordering and storage restrictions. This table defines which types are allowable.

Typefact keyfact value
intyesyes
stringyesyes
bytesyesyes
boolyesyes
idyesyes
optionalnoyes
Structnoyes1
Opaquenono

Immutable facts

Immutable facts are prefixed with the immutable keyword, and can only be created or deleted, never updated. Updating an immutable fact should be a compile error.


  1. Structs can be used in fact values as long as they obey the same rules for their constituent field types.