[][src]Module toql_core::query

This module contains the query and all functions to build one programatically.

Example

This example is not tested
use toql::query::{Query, Field};
 
let  q = Query::new()
       .and(Field::from("foo").hide().eq(5).aggregate().asc(1))
       .and(Field::from("bar").desc(2));
   assert_eq!("+1.foo !EQ 5,-2bar", q.to_string());

To avoid typing mistakes the Toql derive builds functions for all fields in a struct. In the example above it would be possible to write .and(Foobar::fields().bar().desc(2) for a derived struct Foobar.

Read the guide for more information on the query syntax.

Structs

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

Query

A Query contains fields and wildcards. It can be turned into SQL using the SQL Builder.

Wildcard

A wildcard is used to select all fields from top or from a path.

Enums

FieldFilter

The filter operation on a field. You use this when creating a FieldHandler to provide custom functions through the Fn filter or implement a alternative mapping to SQL.

Traits

FilterArg

A trait to convert a simple datatype into a filter argument. Used by builder functions. Not very interesting ;)