pub struct ModelQuery<M> { /* private fields */ }Expand description
A trait for filtering queries
This allows you to filter, limit, offset, and order elements that you are querying.
§Example
User::select()
.filter(User::id.eq(1) & User::name.like("%test%"))
.limit(1)
.order(User::id.desc())
.exec(&conn).unwrap();Implementations§
Source§impl<M: Model> ModelQuery<M>
impl<M: Model> ModelQuery<M>
pub fn select() -> Self
pub fn count() -> ModelQuery<CountQuery>
Source§impl<M> ModelQuery<M>
impl<M> ModelQuery<M>
pub fn combine(self, query: String, params: Vec<Box<dyn ToSql>>) -> Self
Sourcepub fn filter(self, filter: impl ModelQueryFilter) -> Self
pub fn filter(self, filter: impl ModelQueryFilter) -> Self
Sourcepub fn order_by(self, order: ColumnQueryOrder) -> Self
pub fn order_by(self, order: ColumnQueryOrder) -> Self
Sourcepub fn join_relation(self, relation: Column<'static>) -> Self
pub fn join_relation(self, relation: Column<'static>) -> Self
Trait Implementations§
Source§impl<M: Model> ColumnInQuery for ModelQuery<M>
impl<M: Model> ColumnInQuery for ModelQuery<M>
Source§impl<M: Model> Debug for ModelQuery<M>
impl<M: Model> Debug for ModelQuery<M>
Source§impl<M> Default for ModelQuery<M>
impl<M> Default for ModelQuery<M>
Source§impl<M: Model> Executable<Vec<M>> for ModelQuery<M>
impl<M: Model> Executable<Vec<M>> for ModelQuery<M>
Source§impl Executable<usize> for ModelQuery<CountQuery>
impl Executable<usize> for ModelQuery<CountQuery>
Source§impl Queryable<usize> for ModelQuery<CountQuery>
impl Queryable<usize> for ModelQuery<CountQuery>
Auto Trait Implementations§
impl<M> Freeze for ModelQuery<M>
impl<M> !RefUnwindSafe for ModelQuery<M>
impl<M> !Send for ModelQuery<M>
impl<M> !Sync for ModelQuery<M>
impl<M> Unpin for ModelQuery<M>where
M: Unpin,
impl<M> !UnwindSafe for ModelQuery<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more