pub trait SqlxModel:
SqlxRow
+ Clone
+ Send
+ Sync
+ 'static {
const TABLE: &'static str;
const COLUMNS: &'static [ColumnDef];
const COLUMN_NAMES: &'static [&'static str];
const PRIMARY_KEY: &'static str;
const FIELD_COLUMNS: &'static [(&'static str, &'static str)] = _;
const PROVIDER_VERIFICATION_COLUMN: Option<&'static str> = None;
// Required methods
fn into_active(self) -> ActiveRow;
fn from_active(active: ActiveRow) -> AuthResult<Self>;
// Provided methods
fn column_value(column: &str, value: SqlValue) -> SqlValue { ... }
fn timestamp_value(column: &str, value: DateTime<Utc>) -> SqlValue { ... }
fn column_kind(column: &str) -> ColumnKind { ... }
}Expand description
A table-backed SQLx model.
Required Associated Constants§
Sourceconst COLUMN_NAMES: &'static [&'static str]
const COLUMN_NAMES: &'static [&'static str]
The names of COLUMNS, for select and returning lists.
Sourceconst PRIMARY_KEY: &'static str
const PRIMARY_KEY: &'static str
Physical primary-key column.
Provided Associated Constants§
Sourceconst FIELD_COLUMNS: &'static [(&'static str, &'static str)] = _
const FIELD_COLUMNS: &'static [(&'static str, &'static str)] = _
Rust field names paired with their physical columns.
Sourceconst PROVIDER_VERIFICATION_COLUMN: Option<&'static str> = None
const PROVIDER_VERIFICATION_COLUMN: Option<&'static str> = None
Provider verification column whose SQLite storage may retain raw scalars. Other model roles and handwritten models retain their existing projection.
Required Methods§
Sourcefn into_active(self) -> ActiveRow
fn into_active(self) -> ActiveRow
Every column as an unchanged value.
Sourcefn from_active(active: ActiveRow) -> AuthResult<Self>
fn from_active(active: ActiveRow) -> AuthResult<Self>
Materialize a model without a database write. Omitted optional fields
become None; other omitted fields fail.
§Errors
Returns an error if a required field is omitted or has another type.
Provided Methods§
Sourcefn column_value(column: &str, value: SqlValue) -> SqlValue
fn column_value(column: &str, value: SqlValue) -> SqlValue
Apply this physical column’s binding override without changing its Rust String representation. Ordinary TEXT/VARCHAR columns remain unchanged.
Sourcefn timestamp_value(column: &str, value: DateTime<Utc>) -> SqlValue
fn timestamp_value(column: &str, value: DateTime<Utc>) -> SqlValue
Bind the auth UTC clock using this model column’s timestamp wire type.
fn column_kind(column: &str) -> ColumnKind
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".