pub struct Query<M> {
pub distinct: bool,
pub aux_params: HashMap<String, SqlArg>,
pub where_predicates: Vec<String>,
pub where_predicate_params: Vec<SqlArg>,
pub select_columns: Vec<String>,
pub join_stmts: Vec<String>,
pub join_stmt_params: Vec<SqlArg>,
pub type_marker: PhantomData<M>,
/* private fields */
}
Fields
distinct: bool
Select DISTINCT
aux_params: HashMap<String, SqlArg>
Aux params used with query
where_predicates: Vec<String>
Additional where clause
where_predicate_params: Vec<SqlArg>
Query params for additional sql restriction
select_columns: Vec<String>
Additional select columns
join_stmts: Vec<String>
Additional joins statements
join_stmt_params: Vec<SqlArg>
type_marker: PhantomData<M>
Type marker
Implementations
sourceimpl<M> Query<M>
impl<M> Query<M>
sourcepub fn from<T>(query: T) -> Self where
T: Into<Query<M>>,
pub fn from<T>(query: T) -> Self where
T: Into<Query<M>>,
Create a new query from another query.
sourcepub fn clone_for_type<T>(&self) -> Query<T>
pub fn clone_for_type<T>(&self) -> Query<T>
Create a new query from another query.
pub fn selection(name: impl Into<String>) -> Self
sourcepub fn parenthesize(self) -> Self
pub fn parenthesize(self) -> Self
Wrap query with parentheses.
sourcepub fn and<T>(self, query: T) -> Self where
T: Into<Query<M>>,
pub fn and<T>(self, query: T) -> Self where
T: Into<Query<M>>,
Concatenate field or query with AND.
sourcepub fn and_parentized<T>(self, query: T) -> Self where
T: Into<Query<M>>,
pub fn and_parentized<T>(self, query: T) -> Self where
T: Into<Query<M>>,
Concatenate field or query with AND.
sourcepub fn or<T>(self, query: T) -> Self where
T: Into<Query<M>>,
pub fn or<T>(self, query: T) -> Self where
T: Into<Query<M>>,
Concatenate field or query with OR.
sourcepub fn or_parentized<T>(self, query: T) -> Self where
T: Into<Query<M>>,
pub fn or_parentized<T>(self, query: T) -> Self where
T: Into<Query<M>>,
Concatenate field or query with AND.
sourcepub fn with(self, query_with: impl QueryWith<M>) -> Self
pub fn with(self, query_with: impl QueryWith<M>) -> Self
Modifiy the query with an additional stuct.
sourcepub fn aux_param<S, A>(self, name: S, value: A) -> Self where
A: Into<SqlArg>,
S: Into<String>,
pub fn aux_param<S, A>(self, name: S, value: A) -> Self where
A: Into<SqlArg>,
S: Into<String>,
Convenence method to add aux params
sourcepub fn contains_path(&self, path: &str) -> bool
pub fn contains_path(&self, path: &str) -> bool
Check if query contains path Example: Path is ‘user_address’ Valid query paths are ‘user_’, ‘user_address_’, ’user_address_country_*,‘user_address_id’
sourcepub fn contains_path_starts_with(&self, path: &str) -> bool
pub fn contains_path_starts_with(&self, path: &str) -> bool
Check if query contains path starting with a subpath Example: Path is ‘user_address’ Valid query paths are ‘user_address_*’, ‘user_address_id’
Trait Implementations
sourceimpl<T, K> FromIterator<K> for Query<T> where
K: Key<Entity = T> + Into<Query<T>>,
impl<T, K> FromIterator<K> for Query<T> where
K: Key<Entity = T> + Into<Query<T>>,
Allows to collect different keys in a query (concatenation is or)
sourcefn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Query<T>
fn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Query<T>
Creates a value from an iterator. Read more
sourceimpl<'a, T> FromIterator<Query<T>> for Query<T>
impl<'a, T> FromIterator<Query<T>> for Query<T>
Allows to collect different queries in a query (concatenation is and)
Auto Trait Implementations
impl<M> RefUnwindSafe for Query<M> where
M: RefUnwindSafe,
impl<M> Send for Query<M> where
M: Send,
impl<M> Sync for Query<M> where
M: Sync,
impl<M> Unpin for Query<M> where
M: Unpin,
impl<M> UnwindSafe for Query<M> where
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more