pub struct Schema {
pub fields: Vec<FieldSpec>,
pub unique_keys: Vec<Vec<String>>,
pub summary_template: Option<String>,
pub shard: Option<bool>,
}Expand description
A user-declared type schema parsed from a DB.md ### <type> sub-section.
The store’s ## Schemas is the only source of schema enforcement — the
toolkit ships no built-in or implicit per-type schema (see SPEC § Schemas).
Fields§
§fields: Vec<FieldSpec>One FieldSpec per bulleted field line, in source order.
unique_keys: Vec<Vec<String>>- unique: <field>[, <field> …] directives — each inner vec is one
uniqueness constraint over the listed field(s) (compound when >1). Two
records of this type whose listed values collide warn as
DUP_UNIQUE_KEY.
summary_template: Option<String>- summary_template: <template> directive — the {field} interpolation
pattern dbmd fm init / dbmd write use to compose a default summary
for this type. None falls back to the body’s first paragraph.
shard: Option<bool>- shard: by-date | flat directive — whether records of this type are
date-sharded on disk (records/<type>/<YYYY>/<MM>/…) or kept flat.
None = no directive declared, so the store’s built-in default for the
type applies (crate::store::Store::type_shards); Some(true) forces
date-sharding (e.g. a custom event type the toolkit has no built-in for);
Some(false) forces flat. This is the v0.2 generic-model way to declare
sharding — the toolkit ships no implicit per-type behavior beyond the
example-type defaults.