pub struct Query {
pub distinct_by: Vec<String>,
pub eager_relations: Vec<String>,
pub filter: Option<Filter>,
pub group_by: Vec<String>,
pub having: Option<Filter>,
pub joins: Vec<Join>,
pub limit: Option<usize>,
pub offset: Option<usize>,
pub order_by: Vec<(String, OrderDirection)>,
/* private fields */
}Expand description
A struct representing a query in the DBMS.
Fields§
§distinct_by: Vec<String>Distinct records by the specified fields.
eager_relations: Vec<String>Relations to eagerly load with the main records.
filter: Option<Filter>Filter to apply to the query.
group_by: Vec<String>Group by fields for aggregate queries.
having: Option<Filter>Having Filter for aggregate queries.
joins: Vec<Join>Join operations
limit: Option<usize>Limit on the number of records to return.
offset: Option<usize>Offset for pagination.
order_by: Vec<(String, OrderDirection)>Order by clauses for sorting the results.
Implementations§
Source§impl Query
impl Query
Sourcepub fn builder() -> QueryBuilder
pub fn builder() -> QueryBuilder
Creates a new QueryBuilder for building a query.
Sourcepub fn all_selected(&self) -> bool
pub fn all_selected(&self) -> bool
Returns whether all columns are selected in the query.
Sourcepub fn columns<T>(&self) -> Vec<String>where
T: TableSchema,
pub fn columns<T>(&self) -> Vec<String>where
T: TableSchema,
Returns the list of columns to be selected in the query.
Sourcepub fn raw_columns(&self) -> &[String]
pub fn raw_columns(&self) -> &[String]
Returns the raw column names from the Select clause.
Unlike columns::<T>(), this does not expand Select::All
using the table schema.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Query
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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