pub trait Entity<'a, DB> {
type Table;
// Required methods
fn conditions<M: PersistedFields>(
conditions: Conditions<M>,
junction: Junction,
) -> Result<Option<BoxedCondition<'a, Self::Table, DB>>, ValueMismatch>;
fn order_by<M: PersistedFields>(
sort_keys: SortKeys<M>,
) -> Vec<BoxedOrdering<'a, Self::Table, DB>> ⓘ;
}Expand description
A Diesel entity: one whose columns the model’s data can name, implemented
by #[derive(Columns)] for an entity with #[diesel(table_name = ..)].
Its methods are the entity’s diesel_conditions and diesel_order_by as
a trait, so the code generated for the wrappers (AppendToQuery,
AppendConditions), which knows the entity but not its table,
can name them. DB is the backend, 'a how long the boxed expressions
live.
Required Associated Types§
Required Methods§
Sourcefn conditions<M: PersistedFields>(
conditions: Conditions<M>,
junction: Junction,
) -> Result<Option<BoxedCondition<'a, Self::Table, DB>>, ValueMismatch>
fn conditions<M: PersistedFields>( conditions: Conditions<M>, junction: Junction, ) -> Result<Option<BoxedCondition<'a, Self::Table, DB>>, ValueMismatch>
The conditions of the model M, joined by junction, as one
condition on the table; None when there are none.
§Errors
ValueMismatch if a condition’s value does not fit its column’s SQL
type.
Sourcefn order_by<M: PersistedFields>(
sort_keys: SortKeys<M>,
) -> Vec<BoxedOrdering<'a, Self::Table, DB>> ⓘ
fn order_by<M: PersistedFields>( sort_keys: SortKeys<M>, ) -> Vec<BoxedOrdering<'a, Self::Table, DB>> ⓘ
The sort keys of the model M, in order, as orderings of the table.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".