Struct ::exo::SqlQuery

Overview

Methods

fn new() -> SqlQuery

Creates a new empty SqlQuery This equals a sql query like SELECT * FROM *;

Example

let query = exo::SqlQuery::new();
assert!(query is exo::SqlQuery);

Return the SqlQuery as sql string.

Example

let query = exo::SqlQuery::new();
assert_eq!(query.to_string(), "SELECT * FROM *;");
fn parse_str(inp: String) -> Result

This function tries to parse the SqlQuery from a string.

Example

let query = exo::SqlQuery::parse_str("SELECT * FROM *;")?;
assert_eq!(query,exo::SqlQuery::new());

Clones the SqlQuery and returns a new independet one.

fn model(self, model: String) -> SqlQuery

Set one or multiple models to the SqlQuery. This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().model("user").model("right");
assert_eq!(query.to_string(), "SELECT * FROM user, right;");
fn limit(self, limit: i64) -> SqlQuery

Set the limit of the SqlQuery. This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().limit(10);
assert_eq!(query.to_string(), "SELECT * FROM * LIMIT 10;");
fn offset(self, offset: i64) -> SqlQuery

Set the offset of the SqlQuery. This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().offset(10);
assert_eq!(query.to_string(), "SELECT * FROM * OFFSET 10;");
fn check(self, variable: String, operator: String, value) -> SqlQuery

Set an additonal check/where condition This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().check("ident", "==", "test");
assert_eq!(query.to_string(), "SELECT * FROM * WHERE ident = 'test';");
fn search(self, query: String) -> SqlQuery

Set a full text search query for the given language This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().search("Right");
fn column(self, column: String) -> SqlQuery

Set a specific column for the SqlQuery This functions consumes the SqlQuery and returns it updated.

Example

let query = exo::SqlQuery::new().column("uuid");
assert_eq!(query.to_string(), "SELECT uuid FROM *;");
fn aggregate(self, column: String, function: String) -> SqlQuery

Set a specific aggregate column for the SqlQuery This functions consumes the SqlQuery and returns it updated. Aggregates can not be combined with normal columns.

Example

let query = exo::SqlQuery::new().aggregate("uuid", "count");
assert_eq!(query.to_string(), "SELECT COUNT(uuid) FROM *;");

Protocols

protocol get models
let output = value.models

Allows a get operation to work.

protocol set models
value.models = input

Allows a set operation to work.

protocol get limit
let output = value.limit

Allows a get operation to work.

protocol set limit
value.limit = input

Allows a set operation to work.

protocol get offset
let output = value.offset

Allows a get operation to work.

protocol set offset
value.offset = input

Allows a set operation to work.

protocol get columns
let output = value.columns

Allows a get operation to work.

protocol set columns
value.columns = input

Allows a set operation to work.

protocol get sort_by
let output = value.sort_by

Allows a get operation to work.

protocol set sort_by
value.sort_by = input

Allows a set operation to work.

protocol get sort_order
let output = value.sort_order

Allows a get operation to work.

protocol set sort_order
value.sort_order = input

Allows a set operation to work.

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.