pub trait Model:
DriverRows
+ Send
+ Unpin
+ Sized {
const TABLE: &'static str;
const PRIMARY_KEY: &'static str = "id";
const FILLABLE: &'static [&'static str] = _;
// Provided method
fn query() -> Query<Self> { ... }
}Expand description
A table and the Rust type that its rows map to. Derive it with #[derive(OrbitModel)], or write it by hand.
A model decodes from the row type of every database that the build enables, so DriverRows
holds for it. With only one database enabled, that is the one FromRow for that database.
Required Associated Constants§
Provided Associated Constants§
Sourceconst PRIMARY_KEY: &'static str = "id"
const PRIMARY_KEY: &'static str = "id"
The primary key, used by find. first has no default order, as in Laravel.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".