[−][src]Trait quaint::ast::Comparable
An item that can be compared against other values in the database.
Required methods
fn equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if both sides are the same value.
let query = Select::from_table("users").so_that("foo".equals("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` = ?", sql); assert_eq!( vec![ ParameterizedValue::from("bar"), ], params );
fn not_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if both sides are not the same value.
let query = Select::from_table("users").so_that("foo".not_equals("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` <> ?", sql); assert_eq!( vec![ ParameterizedValue::from("bar"), ], params );
fn less_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is smaller than the right side.
let query = Select::from_table("users").so_that("foo".less_than(10)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` < ?", sql); assert_eq!( vec![ ParameterizedValue::from(10), ], params );
fn less_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is smaller than the right side or the same.
let query = Select::from_table("users").so_that("foo".less_than_or_equals(10)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` <= ?", sql); assert_eq!( vec![ ParameterizedValue::from(10), ], params );
fn greater_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is bigger than the right side.
let query = Select::from_table("users").so_that("foo".greater_than(10)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` > ?", sql); assert_eq!( vec![ ParameterizedValue::from(10), ], params );
fn greater_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is bigger than the right side or the same.
let query = Select::from_table("users").so_that("foo".greater_than_or_equals(10)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` >= ?", sql); assert_eq!( vec![ ParameterizedValue::from(10), ], params );
fn in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is included in the right side collection.
let query = Select::from_table("users").so_that("foo".in_selection(vec![1, 2])); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` IN (?,?)", sql); assert_eq!(vec![ ParameterizedValue::Integer(1), ParameterizedValue::Integer(2), ], params);
fn not_in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
Tests if the left side is not included in the right side collection.
let query = Select::from_table("users").so_that("foo".not_in_selection(vec![1, 2])); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` NOT IN (?,?)", sql); assert_eq!(vec![ ParameterizedValue::Integer(1), ParameterizedValue::Integer(2), ], params);
fn like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side includes the right side string.
let query = Select::from_table("users").so_that("foo".like("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("%bar%"), ], params );
fn not_like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side does not include the right side string.
let query = Select::from_table("users").so_that("foo".not_like("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` NOT LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("%bar%"), ], params );
fn begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side starts with the right side string.
let query = Select::from_table("users").so_that("foo".begins_with("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("bar%"), ], params );
fn not_begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side doesn't start with the right side string.
let query = Select::from_table("users").so_that("foo".not_begins_with("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` NOT LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("bar%"), ], params );
fn ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side ends into the right side string.
let query = Select::from_table("users").so_that("foo".ends_into("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("%bar"), ], params );
fn not_ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
T: Into<Cow<'a, str>>,
Tests if the left side does not end into the right side string.
let query = Select::from_table("users").so_that("foo".not_ends_into("bar")); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` NOT LIKE ?", sql); assert_eq!( vec![ ParameterizedValue::from("%bar"), ], params );
fn is_null(self) -> Compare<'a>
Tests if the left side is NULL
.
let query = Select::from_table("users").so_that("foo".is_null()); let (sql, _) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` IS NULL", sql);
fn is_not_null(self) -> Compare<'a>
Tests if the left side is not NULL
.
let query = Select::from_table("users").so_that("foo".is_not_null()); let (sql, _) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` IS NOT NULL", sql);
fn between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
Tests if the value is between two given values.
let query = Select::from_table("users").so_that("foo".between(420, 666)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` BETWEEN ? AND ?", sql); assert_eq!(vec![ ParameterizedValue::Integer(420), ParameterizedValue::Integer(666), ], params);
fn not_between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
Tests if the value is not between two given values.
let query = Select::from_table("users").so_that("foo".not_between(420, 666)); let (sql, params) = Sqlite::build(query); assert_eq!("SELECT `users`.* FROM `users` WHERE `foo` NOT BETWEEN ? AND ?", sql); assert_eq!(vec![ ParameterizedValue::Integer(420), ParameterizedValue::Integer(666), ], params);
Implementors
impl<'a> Comparable<'a> for DatabaseValue<'a>
[src]
fn equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn is_null(self) -> Compare<'a>
[src]
fn is_not_null(self) -> Compare<'a>
[src]
fn between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
fn not_between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
impl<'a> Comparable<'a> for Row<'a>
[src]
fn equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn is_null(self) -> Compare<'a>
[src]
fn is_not_null(self) -> Compare<'a>
[src]
fn between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
fn not_between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
impl<'a, U> Comparable<'a> for U where
U: Into<Column<'a>>,
[src]
U: Into<Column<'a>>,
fn equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn less_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn greater_than_or_equals<T>(self, comparison: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn not_in_selection<T>(self, selection: T) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
fn like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_like<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_begins_with<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn not_ends_into<T>(self, pattern: T) -> Compare<'a> where
T: Into<Cow<'a, str>>,
[src]
T: Into<Cow<'a, str>>,
fn is_null(self) -> Compare<'a>
[src]
fn is_not_null(self) -> Compare<'a>
[src]
fn between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
fn not_between<T, V>(self, left: T, right: V) -> Compare<'a> where
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,
[src]
T: Into<DatabaseValue<'a>>,
V: Into<DatabaseValue<'a>>,