#[entity]Expand description
Author a typed record with named fields, a supplied scalar key and indexes.
Each field has an associated name constant, e.g. User::NAME for name.
Field types follow the implemented ic_db::FieldType contract, with explicit
bounds for variable-size values. Secondary indexes admit supported ordered
scalar fields and unit enums, including optional forms. Optional unique indexes require
present_only, omitting a row when any optional key component is absent. Unsupported shapes
refuse explicitly; this is not a retirement of the broader planned type surface.
Entity names default to the type name; name = "StableName" overrides it.
Index names default to comma-separated ordered fields; name overrides them.
Required or optional supported key fields may declare references(entity = "path::Target");
select the sole unfiltered index leading with this field, or use index = "name".
None has no target; every Some(id) requires that target in the final batch state.
entity = "path::Target" lets Rust resolve an entity type (including imports
and Self) to its logical identity. Numeric authoring IDs are unsupported.
With the host-only ic-db/build feature, declarations also register their
full Rust paths for second-stage schema assembly.
Fields may declare default = LITERAL for integers, Bool, bounded Text and Blob.
Blob defaults use Rust byte strings, e.g. default = b"\x00\xff", never text/hex coercion.
Entity::insert() builds typed omission-aware input for Batch::insert_input;
explicit optional None is never replaced by a default. Primary-key and nested
record defaults are not implemented. Defaults never run on decode/replacement.
Required Timestamp fields and their scalar newtypes may declare managed = "created_at" or
managed = "updated_at", once per role. These fields have no insert setters;
use Batch::at(time) to supply one operation time for the entire batch.