DRAFTThis page is not published. Only visible in development mode.

Tags

A tag is a named set of variants used to classify data - most prominently the entries of a series. Where an enum types a column and an event triggers handlers, a tag labels rows: same variant syntax, different role.

Declaring a tag

Variants can be bare labels or carry typed payload fields. Here Sensor records where a reading came from, while Manual is a plain marker. Run the snippets on this page in order:

$ A Tag Type with Payload and Unit Variants
$ ctrl+enter to run

Attaching it to a series

A series opts into classification with with { tag: ns::tag_type }. Entries can then be labeled with a variant - which sensor produced the value, whether a record was entered by hand - without adding columns to the series schema itself:

$ Attach the Tag to a Series
$ ctrl+enter to run
Classification, not dispatch
Tags describe data at rest. If you need variants that trigger behavior when something happens, declare an event and attach handlers to it.