[−][src]Struct toql_core::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) -> Self where
T: Into<String>,
[src]
T: Into<String>,
Create a field for the given name.
pub fn hide(self) -> Self
[src]
Hide field. Useful if a field should not be selected, but be used for filtering.
pub fn aggregate(self) -> Self
[src]
Aggregate a field to make the filter be in SQL HAVING clause instead of WHERE clause
pub fn asc(self, order: u8) -> Self
[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) -> Self
[src]
Use this field to order records in descending way. Give ordering priority when records are ordered by multiple fields.
pub fn eq<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with equal predicate.
pub fn eqn(self) -> Self
[src]
Filter records with equal null predicate.
pub fn ne<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with not equal predicate.
pub fn nen(self) -> Self
[src]
Filter records with not equal null predicate.
pub fn gt<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with greater that_ predicate.
pub fn ge<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with greater or equal_ predicate.
pub fn lt<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with lesser than_ predicate.
pub fn le<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with lesser or equal_ predicate.
pub fn bw<T>(self, lower: impl FilterArg<T>, upper: impl FilterArg<T>) -> Self
[src]
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>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with like predicate.
pub fn re<T>(self, criteria: impl FilterArg<T>) -> Self
[src]
Filter records with regex predicate.
pub fn ins<T>(self, criteria: Vec<impl FilterArg<T>>) -> Self
[src]
Filter records with inside predicate.
pub fn out<T>(self, criteria: Vec<impl FilterArg<T>>) -> Self
[src]
Filter records with outside predicate.
pub fn fnc<U, T>(self, name: U, args: Vec<impl FilterArg<T>>) -> Self where
U: Into<String>,
[src]
U: Into<String>,
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 ToString for Field
[src]
impl Clone for Field
[src]
fn clone(&self) -> Field
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'_> From<&'_ str> for Field
[src]
impl From<Field> for Query
[src]
impl Debug for Field
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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, 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,