[][src]Struct toql::query::Field

pub struct Field { /* fields omitted */ }

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

This example is not tested
  
 let f = Field::from("id");

its easier and recommended to write

This example is not tested
 let f = User::fields().id();

Methods

impl Field[src]

pub fn from<T>(name: T) -> Field where
    T: Into<String>, 
[src]

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]

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]

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]

Filter records with greater that_ predicate.

pub fn ge<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

Filter records with greater or equal_ predicate.

pub fn lt<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

Filter records with lesser than_ predicate.

pub fn le<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

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]

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]

Filter records with like predicate.

pub fn re<T, impl FilterArg>(self, criteria: impl FilterArg) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

Filter records with regex predicate.

pub fn ins<T, impl FilterArg>(
    self,
    criteria: Vec<impl FilterArg>
) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

Filter records with inside predicate.

pub fn out<T, impl FilterArg>(
    self,
    criteria: Vec<impl FilterArg>
) -> Field where
    impl FilterArg: FilterArg<T>, 
[src]

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]

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 Clone for Field[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<Field> for Query[src]

impl<'_> From<&'_ str> for Field[src]

impl ToString for Field[src]

Auto Trait Implementations

impl Send for Field

impl Sync for Field

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]