pub trait Model:
Sized
+ Send
+ Sync {
const MODEL_NAME: &'static str;
const TABLE_NAME: &'static str;
const PRIMARY_KEY: &'static [&'static str];
const COLUMNS: &'static [&'static str];
const GENERATED_FIELDS: &'static [(&'static str, &'static str, bool)] = _;
const AGGREGATE_FIELDS: &'static [(&'static str, &'static str, &'static str, Option<&'static str>)] = _;
}Expand description
A model that can be queried.
Required Associated Constants§
Sourceconst MODEL_NAME: &'static str
const MODEL_NAME: &'static str
The name of the model (used for table name).
Sourceconst TABLE_NAME: &'static str
const TABLE_NAME: &'static str
The name of the database table.
Sourceconst PRIMARY_KEY: &'static [&'static str]
const PRIMARY_KEY: &'static [&'static str]
The primary key column name(s).
Provided Associated Constants§
Sourceconst GENERATED_FIELDS: &'static [(&'static str, &'static str, bool)] = _
const GENERATED_FIELDS: &'static [(&'static str, &'static str, bool)] = _
Metadata for fields annotated with #[prax(generated = "expr")].
Each entry is (field_name, expression, stored) where stored is
true for a physically-stored generated column and false for a
virtual (computed-on-read) column.
Models without any generated fields default to an empty slice.
Sourceconst AGGREGATE_FIELDS: &'static [(&'static str, &'static str, &'static str, Option<&'static str>)] = _
const AGGREGATE_FIELDS: &'static [(&'static str, &'static str, &'static str, Option<&'static str>)] = _
Metadata for fields annotated with aggregate directives
(#[prax(count(rel))], #[prax(sum(rel.field))], etc.).
Each entry is (field_name, kind_str, relation, field) where
kind_str is one of "count", "sum", "avg", "min", "max",
relation is the relation name, and field is the target field
(always None for count).
Models without any aggregate fields default to an empty slice.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".