Prostore::Model
Base class for all prostore-managed models.
Subclasses declare their schema in the class body via the macros installed
by inherited and the macros defined in macros.cr. At compile time, a
Prostore::Schema::Definition value is built and exposed as
Class.prostore_schema.
Class methods
Build a query Builder for the given model class using the default Prostore connection. Used by macro-emitted class methods.
Instance methods
Macros
field tag, :name, Type, **opts
Options (ADR-0011, 0013, 0014): primary: Bool (default false) auto_increment: Bool (default false; requires Int32/Int64 + primary) default: SQL.expr | Proc (new-row strategy) backfill: SQL.expr | Proc (existing-row strategy) lazy: Proc (mutex with default: / backfill:; requires T?)
index tag, [:cols], unique: false, where: SQL.expr(...), name: "..."
query :name, ->(args) { body }
The lambda body is walked as an AST chain; each method call becomes a
Schema::Call record consumed by Query::Analyzer for index planning.
Reserved DSL keyword for future standalone sequences (ADR-0013).
Currently excluded; only auto_increment: true on integer PKs is
supported.