[−][src]Struct toql::query::Field
A Toql field can select, filter and order a database column or expression A field can be created from a field name and filtered, sorted with its methods. However the Toql derive creates fields structs for a derived struct, so instead of
let f = Field::from("id");
its easier and recommended to write
let f = User::fields().id();
Methods
impl Field
[src]
pub fn from<T>(name: T) -> Field where
T: Into<String>,
[src]
T: Into<String>,
Create a field for the given name.
pub fn hide(self) -> Field
[src]
Hide field. Useful if a field should not be selected, but be used for filtering.
pub fn aggregate(self) -> Field
[src]
Aggregate a field to make the filter be in SQL HAVING clause instead of WHERE clause
pub fn asc(self, order: u8) -> Field
[src]
Use this field to order records in ascending way. Give ordering priority when records are ordered by multiple fields.
pub fn desc(self, order: u8) -> Field
[src]
Use this field to order records in descending way. Give ordering priority when records are ordered by multiple fields.
pub fn eq<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with equal predicate.
pub fn eqn(self) -> Field
[src]
Filter records with equal null predicate.
pub fn ne<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with not equal predicate.
pub fn nen(self) -> Field
[src]
Filter records with not equal null predicate.
pub fn gt<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with greater that_ predicate.
pub fn ge<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with greater or equal_ predicate.
pub fn lt<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with lesser than_ predicate.
pub fn le<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with lesser or equal_ predicate.
pub fn bw<T, impl FilterArg, impl FilterArg>(
self,
lower: impl FilterArg,
upper: impl FilterArg
) -> Field where
impl FilterArg: FilterArg<T> + FilterArg<T>,
[src]
self,
lower: impl FilterArg
upper: impl FilterArg
) -> Field where
impl FilterArg
Filter records with between predicate. This is inclusive, so x bw 3 6
is the same as x ge 3, x le 6
pub fn lk<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with like predicate.
pub fn re<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
impl FilterArg: FilterArg<T>,
[src]
impl FilterArg
Filter records with regex predicate.
pub fn ins<T, impl FilterArg>(
self,
criteria: Vec<impl FilterArg>
) -> Field where
impl FilterArg: FilterArg<T>,
[src]
self,
criteria: Vec<impl FilterArg
) -> Field where
impl FilterArg
Filter records with inside predicate.
pub fn out<T, impl FilterArg>(
self,
criteria: Vec<impl FilterArg>
) -> Field where
impl FilterArg: FilterArg<T>,
[src]
self,
criteria: Vec<impl FilterArg
) -> Field where
impl FilterArg
Filter records with outside predicate.
pub fn fnc<U, T, impl FilterArg>(
self,
name: U,
args: Vec<impl FilterArg>
) -> Field where
U: Into<String>,
impl FilterArg: FilterArg<T>,
[src]
self,
name: U,
args: Vec<impl FilterArg
) -> Field where
U: Into<String>,
impl FilterArg
Filter records with custom function. To provide a custom function you must implement (FieldHandler)[../sql_mapper/trait.FieldHandler.html] See custom handler test for an example.
Trait Implementations
impl Into<QueryToken> for Field
[src]
impl Debug for Field
[src]
impl ToString for Field
[src]
impl From<Field> for Query
[src]
impl<'_> From<&'_ str> for Field
[src]
impl Clone for Field
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,