Struct Expr
pub struct Expr { /* private fields */ }
Expand description
Helper to build a SimpleExpr
.
Implementations§
§impl Expr
impl Expr
pub fn asterisk() -> Expr
Asterisk
]pub fn col<T>(n: T) -> Exprwhere
T: IntoColumnRef,
pub fn col<T>(n: T) -> Exprwhere
T: IntoColumnRef,
Express the target column without table prefix.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col(Char::SizeW).eq(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `size_w` = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" = 1"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).eq(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" = 1"#
);
pub fn column<T>(n: T) -> SimpleExprwhere
T: IntoColumnRef,
pub fn column<T>(n: T) -> SimpleExprwhere
T: IntoColumnRef,
Express the target column without table prefix, returning a SimpleExpr
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::column(Char::SizeW).eq(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `size_w` = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" = 1"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::column((Char::Table, Char::SizeW)).eq(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" = 1"#
);
pub fn tuple<I>(n: I) -> Exprwhere
I: IntoIterator<Item = SimpleExpr>,
pub fn tuple<I>(n: I) -> Exprwhere
I: IntoIterator<Item = SimpleExpr>,
Wraps tuple of SimpleExpr
, can be used for tuple comparison
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(
Expr::tuple([Expr::col(Char::SizeW).into(), Expr::value(100)])
.lt(Expr::tuple([Expr::value(500), Expr::value(100)])))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE (`size_w`, 100) < (500, 100)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE ("size_w", 100) < (500, 100)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE ("size_w", 100) < (500, 100)"#
);
pub fn table_asterisk<T>(t: T) -> Exprwhere
T: IntoIden,
Asterisk
]pub fn val<V>(v: V) -> Expr
pub fn val<V>(v: V) -> Expr
Express a Value
, returning a Expr
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).into())
.and_where(Expr::val(2.5).into())
.and_where(Expr::val("3").into())
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 AND 2.5 AND '3'"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 AND 2.5 AND '3'"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 AND 2.5 AND '3'"#
);
pub fn expr<T>(expr: T) -> Exprwhere
T: Into<SimpleExpr>,
pub fn expr<T>(expr: T) -> Exprwhere
T: Into<SimpleExpr>,
Wrap a SimpleExpr
and perform some operation on it.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::expr(Expr::col(Char::SizeW).if_null(0)).gt(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE IFNULL(`size_w`, 0) > 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE COALESCE("size_w", 0) > 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE IFNULL("size_w", 0) > 2"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.column(Char::Character)
.from(Char::Table)
.and_where(Expr::expr(Func::lower(Expr::col(Char::Character))).is_in(["a", "b"]))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character` FROM `character` WHERE LOWER(`character`) IN ('a', 'b')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
);
pub fn value<V>(v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn value<V>(v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a Value
, returning a SimpleExpr
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::value(1))
.and_where(Expr::value(2.5))
.and_where(Expr::value("3"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 AND 2.5 AND '3'"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 AND 2.5 AND '3'"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 AND 2.5 AND '3'"#
);
pub fn cust<T>(s: T) -> SimpleExpr
pub fn cust<T>(s: T) -> SimpleExpr
Express any custom expression in &str
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::cust("1 = 1"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 = 1"#
);
pub fn cust_with_values<T, V, I>(s: T, v: I) -> SimpleExpr
pub fn cust_with_values<T, V, I>(s: T, v: I) -> SimpleExpr
Express any custom expression with Value
. Use this if your expression needs variables.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col(Char::Id).eq(1))
.and_where(Expr::cust_with_values("6 = ? * ?", [2, 3]))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `id` = 1 AND (6 = 2 * 3)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "id" = 1 AND (6 = 2 * 3)"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col(Char::Id).eq(1))
.and_where(Expr::cust_with_values("6 = $2 * $1", [3, 2]))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "id" = 1 AND (6 = 2 * 3)"#
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::cust_with_values("6 = ? * ?", [2, 3]))
.to_owned();
assert_eq!(query.to_string(MysqlQueryBuilder), r#"SELECT 6 = 2 * 3"#);
assert_eq!(query.to_string(SqliteQueryBuilder), r#"SELECT 6 = 2 * 3"#);
Postgres only: use $$
to escape $
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::cust_with_values("$1 $$ $2", ["a", "b"]))
.to_owned();
assert_eq!(query.to_string(PostgresQueryBuilder), r#"SELECT 'a' $ 'b'"#);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::cust_with_values("data @? ($1::JSONPATH)", ["hello"]))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT data @? ('hello'::JSONPATH)"#
);
pub fn cust_with_expr<T, E>(s: T, expr: E) -> SimpleExpr
pub fn cust_with_expr<T, E>(s: T, expr: E) -> SimpleExpr
Express any custom expression with SimpleExpr
. Use this if your expression needs other expression.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::val(1).add(2))
.expr(Expr::cust_with_expr("data @? ($1::JSONPATH)", "hello"))
.to_owned();
let (sql, values) = query.build(PostgresQueryBuilder);
assert_eq!(sql, r#"SELECT $1 + $2, data @? ($3::JSONPATH)"#);
assert_eq!(
values,
Values(vec![1i32.into(), 2i32.into(), "hello".into()])
);
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::cust_with_expr(
"json_agg(DISTINCT $1)",
Expr::col(Char::Character),
))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT json_agg(DISTINCT "character")"#
);
pub fn cust_with_exprs<T, I>(s: T, v: I) -> SimpleExpr
pub fn cust_with_exprs<T, I>(s: T, v: I) -> SimpleExpr
Express any custom expression with SimpleExpr
. Use this if your expression needs other expressions.
pub fn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an equal (=
) expression.
This is equivalent to a newer ExprTrait::eq and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val("What!").eq("Nothing"))
.and_where(Expr::col(Char::Id).eq(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 'What!' = 'Nothing' AND `id` = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 'What!' = 'Nothing' AND "id" = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 'What!' = 'Nothing' AND "id" = 1"#
);
pub fn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a not equal (<>
) expression.
This is equivalent to a newer ExprTrait::ne and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val("Morning").ne("Good"))
.and_where(Expr::col(Char::Id).ne(1))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 'Morning' <> 'Good' AND `id` <> 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 'Morning' <> 'Good' AND "id" <> 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 'Morning' <> 'Good' AND "id" <> 1"#
);
pub fn equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
pub fn equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
Express a equal expression between two table columns, you will mainly use this to relate identical value between two table columns.
This is equivalent to a newer ExprTrait::equals and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::FontId)).equals((Font::Table, Font::Id)))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`font_id` = `font`.`id`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."font_id" = "font"."id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."font_id" = "font"."id""#
);
pub fn not_equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
pub fn not_equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
Express a not equal expression between two table columns, you will mainly use this to relate identical value between two table columns.
This is equivalent to a newer ExprTrait::not_equals and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::FontId)).not_equals((Font::Table, Font::Id)))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`font_id` <> `font`.`id`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."font_id" <> "font"."id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."font_id" <> "font"."id""#
);
pub fn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a greater than (>
) expression.
This is equivalent to a newer ExprTrait::gt and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).gt(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` > 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" > 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" > 2"#
);
pub fn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a greater than or equal (>=
) expression.
This is equivalent to a newer ExprTrait::gte and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).gte(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` >= 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" >= 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" >= 2"#
);
pub fn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a less than (<
) expression.
This is equivalent to a newer ExprTrait::lt and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).lt(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` < 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" < 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" < 2"#
);
pub fn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a less than or equal (<=
) expression.
This is equivalent to a newer ExprTrait::lte and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).lte(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` <= 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" <= 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" <= 2"#
);
pub fn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an arithmetic addition operation.
This is equivalent to a newer ExprTrait::add and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).add(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 + 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 + 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 + 1 = 2"#
);
pub fn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an arithmetic subtraction operation.
This is equivalent to a newer ExprTrait::sub and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).sub(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 - 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 - 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 - 1 = 2"#
);
pub fn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an arithmetic multiplication operation.
This is equivalent to a newer ExprTrait::mul and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).mul(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 * 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 * 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 * 1 = 2"#
);
pub fn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an arithmetic division operation.
This is equivalent to a newer ExprTrait::div and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).div(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 / 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 / 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 / 1 = 2"#
);
pub fn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express an arithmetic modulo operation.
This is equivalent to a newer ExprTrait::modulo and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).modulo(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 % 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 % 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 % 1 = 2"#
);
pub fn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a bitwise left shift.
This is equivalent to a newer ExprTrait::left_shift and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).left_shift(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 << 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 << 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 << 1 = 2"#
);
pub fn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a bitwise right shift.
This is equivalent to a newer ExprTrait::right_shift and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::val(1).right_shift(1).eq(2))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE 1 >> 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 >> 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE 1 >> 1 = 2"#
);
pub fn between<V>(self, a: V, b: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn between<V>(self, a: V, b: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a BETWEEN
expression.
This is equivalent to a newer ExprTrait::between and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).between(1, 10))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` BETWEEN 1 AND 10"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" BETWEEN 1 AND 10"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" BETWEEN 1 AND 10"#
);
pub fn not_between<V>(self, a: V, b: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn not_between<V>(self, a: V, b: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a NOT BETWEEN
expression.
This is equivalent to a newer ExprTrait::not_between and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).not_between(1, 10))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` NOT BETWEEN 1 AND 10"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" NOT BETWEEN 1 AND 10"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" NOT BETWEEN 1 AND 10"#
);
pub fn like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
pub fn like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
Express a LIKE
expression.
This is equivalent to a newer ExprTrait::like and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::Character)).like("Ours'%"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`character` LIKE 'Ours\'%'"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."character" LIKE E'Ours\'%'"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."character" LIKE 'Ours''%'"#
);
Like with ESCAPE
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::Character)).like(LikeExpr::new(r"|_Our|_").escape('|')))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`character` LIKE '|_Our|_' ESCAPE '|'"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."character" LIKE '|_Our|_' ESCAPE '|'"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."character" LIKE '|_Our|_' ESCAPE '|'"#
);
pub fn not_like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
pub fn not_like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
Express a NOT LIKE
expression.
This is equivalent to a newer ExprTrait::not_like and may require more some wrapping beforehand.
pub fn is_null(self) -> SimpleExpr
pub fn is_null(self) -> SimpleExpr
Express a IS NULL
expression.
This is equivalent to a newer ExprTrait::is_null and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_null())
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` IS NULL"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" IS NULL"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" IS NULL"#
);
pub fn is<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn is<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a IS
expression.
This is equivalent to a newer ExprTrait::is and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::Ascii)).is(true))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`ascii` IS TRUE"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."ascii" IS TRUE"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."ascii" IS TRUE"#
);
pub fn is_not_null(self) -> SimpleExpr
pub fn is_not_null(self) -> SimpleExpr
Express a IS NOT NULL
expression.
This is equivalent to a newer ExprTrait::is_not_null and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_not_null())
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`size_w` IS NOT NULL"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" IS NOT NULL"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."size_w" IS NOT NULL"#
);
pub fn is_not<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn is_not<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a IS NOT
expression.
This is equivalent to a newer ExprTrait::is_not and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::Ascii)).is_not(true))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `character`.`ascii` IS NOT TRUE"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."ascii" IS NOT TRUE"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "character"."ascii" IS NOT TRUE"#
);
pub fn binary<O, T>(self, op: O, right: T) -> SimpleExpr
pub fn binary<O, T>(self, op: O, right: T) -> SimpleExpr
Create any binary operation
This is equivalent to a newer ExprTrait::binary and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.cond_where(all![
Expr::col(Char::SizeW).binary(BinOper::SmallerThan, 10),
Expr::col(Char::SizeW).binary(BinOper::GreaterThan, Expr::col(Char::SizeH))
])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `size_w` < 10 AND `size_w` > `size_h`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" < 10 AND "size_w" > "size_h""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" < 10 AND "size_w" > "size_h""#
);
pub fn not(self) -> SimpleExpr
pub fn not(self) -> SimpleExpr
Negates an expression with NOT
.
This is equivalent to a newer ExprTrait::not and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::expr(Expr::col((Char::Table, Char::SizeW)).is_null()).not())
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE NOT `character`.`size_w` IS NULL"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE NOT "character"."size_w" IS NULL"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE NOT "character"."size_w" IS NULL"#
);
pub fn max(self) -> SimpleExpr
pub fn max(self) -> SimpleExpr
Express a MAX
function.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).max())
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT MAX(`character`.`size_w`) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT MAX("character"."size_w") FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT MAX("character"."size_w") FROM "character""#
);
pub fn min(self) -> SimpleExpr
pub fn min(self) -> SimpleExpr
Express a MIN
function.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).min())
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT MIN(`character`.`size_w`) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT MIN("character"."size_w") FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT MIN("character"."size_w") FROM "character""#
);
pub fn sum(self) -> SimpleExpr
pub fn sum(self) -> SimpleExpr
Express a SUM
function.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).sum())
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT SUM(`character`.`size_w`) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT SUM("character"."size_w") FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT SUM("character"."size_w") FROM "character""#
);
pub fn count(self) -> SimpleExpr
pub fn count(self) -> SimpleExpr
Express a COUNT
function.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).count())
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT COUNT(`character`.`size_w`) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT COUNT("character"."size_w") FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT COUNT("character"."size_w") FROM "character""#
);
pub fn count_distinct(self) -> SimpleExpr
pub fn count_distinct(self) -> SimpleExpr
Express a COUNT
function with the DISTINCT modifier.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).count_distinct())
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT COUNT(DISTINCT `character`.`size_w`) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT COUNT(DISTINCT "character"."size_w") FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT COUNT(DISTINCT "character"."size_w") FROM "character""#
);
pub fn if_null<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
pub fn if_null<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Express a IF NULL
function.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col((Char::Table, Char::SizeW)).if_null(0))
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT IFNULL(`character`.`size_w`, 0) FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT COALESCE("character"."size_w", 0) FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT IFNULL("character"."size_w", 0) FROM "character""#
);
pub fn is_in<V, I>(self, v: I) -> SimpleExpr
pub fn is_in<V, I>(self, v: I) -> SimpleExpr
Express a IN
expression.
This is equivalent to a newer ExprTrait::is_in and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Id])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_in([1, 2, 3]))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE `character`.`size_w` IN (1, 2, 3)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "character"."size_w" IN (1, 2, 3)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "character"."size_w" IN (1, 2, 3)"#
);
Empty value list
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Id])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_in(Vec::<u8>::new()))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE 1 = 2"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE 1 = 2"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "id" FROM "character" WHERE 1 = 2"#
);
pub fn in_tuples<V, I>(self, v: I) -> SimpleExprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
pub fn in_tuples<V, I>(self, v: I) -> SimpleExprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
Express a IN
sub expression.
This is equivalent to a newer ExprTrait::in_tuples and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::FontId])
.from(Char::Table)
.and_where(
Expr::tuple([
Expr::col(Char::Character).into(),
Expr::col(Char::FontId).into(),
])
.in_tuples([(1, String::from("1")), (2, String::from("2"))])
)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `font_id` FROM `character` WHERE (`character`, `font_id`) IN ((1, '1'), (2, '2'))"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "font_id" FROM "character" WHERE ("character", "font_id") IN ((1, '1'), (2, '2'))"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "font_id" FROM "character" WHERE ("character", "font_id") IN ((1, '1'), (2, '2'))"#
);
pub fn is_not_in<V, I>(self, v: I) -> SimpleExpr
pub fn is_not_in<V, I>(self, v: I) -> SimpleExpr
Express a NOT IN
expression.
This is equivalent to a newer ExprTrait::is_not_in and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Id])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_not_in([1, 2, 3]))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE `character`.`size_w` NOT IN (1, 2, 3)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "character"."size_w" NOT IN (1, 2, 3)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "character"."size_w" NOT IN (1, 2, 3)"#
);
Empty value list
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.columns([Char::Id])
.from(Char::Table)
.and_where(Expr::col((Char::Table, Char::SizeW)).is_not_in(Vec::<u8>::new()))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE 1 = 1"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE 1 = 1"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "id" FROM "character" WHERE 1 = 1"#
);
pub fn in_subquery(self, sel: SelectStatement) -> SimpleExpr
pub fn in_subquery(self, sel: SelectStatement) -> SimpleExpr
Express a IN
sub-query expression.
This is equivalent to a newer ExprTrait::in_subquery and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col(Char::SizeW).in_subquery(
Query::select()
.expr(Expr::cust("3 + 2 * 2"))
.take()
))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `size_w` IN (SELECT 3 + 2 * 2)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" IN (SELECT 3 + 2 * 2)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" IN (SELECT 3 + 2 * 2)"#
);
pub fn not_in_subquery(self, sel: SelectStatement) -> SimpleExpr
pub fn not_in_subquery(self, sel: SelectStatement) -> SimpleExpr
Express a NOT IN
sub-query expression.
This is equivalent to a newer ExprTrait::not_in_subquery and may require more some wrapping beforehand.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.columns([Char::Character, Char::SizeW, Char::SizeH])
.from(Char::Table)
.and_where(Expr::col(Char::SizeW).not_in_subquery(
Query::select()
.expr(Expr::cust("3 + 2 * 2"))
.take()
))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character`, `size_w`, `size_h` FROM `character` WHERE `size_w` NOT IN (SELECT 3 + 2 * 2)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" NOT IN (SELECT 3 + 2 * 2)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "size_w" NOT IN (SELECT 3 + 2 * 2)"#
);
pub fn exists(sel: SelectStatement) -> SimpleExpr
pub fn exists(sel: SelectStatement) -> SimpleExpr
Express a EXISTS
sub-query expression.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.expr_as(Expr::exists(Query::select().column(Char::Id).from(Char::Table).take()), Alias::new("character_exists"))
.expr_as(Expr::exists(Query::select().column(Glyph::Id).from(Glyph::Table).take()), Alias::new("glyph_exists"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT EXISTS(SELECT `id` FROM `character`) AS `character_exists`, EXISTS(SELECT `id` FROM `glyph`) AS `glyph_exists`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT EXISTS(SELECT "id" FROM "character") AS "character_exists", EXISTS(SELECT "id" FROM "glyph") AS "glyph_exists""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT EXISTS(SELECT "id" FROM "character") AS "character_exists", EXISTS(SELECT "id" FROM "glyph") AS "glyph_exists""#
);
pub fn any(sel: SelectStatement) -> SimpleExpr
pub fn any(sel: SelectStatement) -> SimpleExpr
Express a ANY
sub-query expression.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.column(Char::Id)
.from(Char::Table)
.and_where(Expr::col(Char::Id).eq(Expr::any(
Query::select().column(Char::Id).from(Char::Table).take(),
)))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE `id` = ANY(SELECT `id` FROM `character`)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "id" = ANY(SELECT "id" FROM "character")"#
);
pub fn some(sel: SelectStatement) -> SimpleExpr
pub fn some(sel: SelectStatement) -> SimpleExpr
Express a SOME
sub-query expression.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.column(Char::Id)
.from(Char::Table)
.and_where(Expr::col(Char::Id).ne(Expr::some(
Query::select().column(Char::Id).from(Char::Table).take(),
)))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `id` FROM `character` WHERE `id` <> SOME(SELECT `id` FROM `character`)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "id" FROM "character" WHERE "id" <> SOME(SELECT "id" FROM "character")"#
);
pub fn all(sel: SelectStatement) -> SimpleExpr
pub fn all(sel: SelectStatement) -> SimpleExpr
Express a ALL
sub-query expression.
pub fn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
pub fn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
Express a AS enum
expression.
This is equivalent to a newer ExprTrait::as_enum and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::col(Char::FontSize).as_enum(Alias::new("text")))
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `font_size` FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CAST("font_size" AS text) FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "font_size" FROM "character""#
);
struct TextArray;
impl Iden for TextArray {
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
write!(s, "text[]").unwrap();
}
}
let query = Query::select()
.expr(Expr::col(Char::FontSize).as_enum(TextArray))
.from(Char::Table)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `font_size` FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CAST("font_size" AS text[]) FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "font_size" FROM "character""#
);
let query = Query::insert()
.into_table(Char::Table)
.columns([Char::FontSize])
.values_panic([Expr::val("large").as_enum(Alias::new("FontSizeEnum"))])
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"INSERT INTO `character` (`font_size`) VALUES ('large')"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"INSERT INTO "character" ("font_size") VALUES (CAST('large' AS FontSizeEnum))"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"INSERT INTO "character" ("font_size") VALUES ('large')"#
);
pub fn case<C, T>(cond: C, then: T) -> CaseStatement
pub fn case<C, T>(cond: C, then: T) -> CaseStatement
Adds new CASE WHEN
to existing case statement.
§Examples
use sea_query::{*, tests_cfg::*};
let query = Query::select()
.expr_as(
Expr::case(
Expr::col((Glyph::Table, Glyph::Aspect)).is_in([2, 4]),
true
)
.finally(false),
Alias::new("is_even")
)
.from(Glyph::Table)
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT (CASE WHEN ("glyph"."aspect" IN (2, 4)) THEN TRUE ELSE FALSE END) AS "is_even" FROM "glyph""#
);
pub fn cast_as<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
pub fn cast_as<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
Express a CAST AS
expression.
This is equivalent to a newer ExprTrait::cast_as and may require more some wrapping beforehand.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(Expr::val("1").cast_as(Alias::new("integer")))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT CAST('1' AS integer)"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CAST('1' AS integer)"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT CAST('1' AS integer)"#
);
pub fn current_date() -> Expr
pub fn current_date() -> Expr
Keyword CURRENT_DATE
.
§Examples
use sea_query::*;
let query = Query::select().expr(Expr::current_date()).to_owned();
assert_eq!(query.to_string(MysqlQueryBuilder), r#"SELECT CURRENT_DATE"#);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CURRENT_DATE"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT CURRENT_DATE"#
);
pub fn current_time() -> Expr
pub fn current_time() -> Expr
Keyword CURRENT_TIMESTAMP
.
§Examples
use sea_query::*;
let query = Query::select().expr(Expr::current_time()).to_owned();
assert_eq!(query.to_string(MysqlQueryBuilder), r#"SELECT CURRENT_TIME"#);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CURRENT_TIME"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT CURRENT_TIME"#
);
pub fn current_timestamp() -> Expr
pub fn current_timestamp() -> Expr
Keyword CURRENT_TIMESTAMP
.
§Examples
use sea_query::{Expr, MysqlQueryBuilder, PostgresQueryBuilder, Query, SqliteQueryBuilder};
let query = Query::select().expr(Expr::current_timestamp()).to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT CURRENT_TIMESTAMP"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT CURRENT_TIMESTAMP"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT CURRENT_TIMESTAMP"#
);
pub fn custom_keyword<T>(i: T) -> Exprwhere
T: IntoIden,
pub fn custom_keyword<T>(i: T) -> Exprwhere
T: IntoIden,
Custom keyword.
§Examples
use sea_query::*;
let query = Query::select()
.expr(Expr::custom_keyword(Alias::new("test")))
.to_owned();
assert_eq!(query.to_string(MysqlQueryBuilder), r#"SELECT test"#);
assert_eq!(query.to_string(PostgresQueryBuilder), r#"SELECT test"#);
assert_eq!(query.to_string(SqliteQueryBuilder), r#"SELECT test"#);
Trait Implementations§
§impl From<Expr> for SimpleExpr
impl From<Expr> for SimpleExpr
§fn from(src: Expr) -> SimpleExpr
fn from(src: Expr) -> SimpleExpr
Convert into SimpleExpr
§impl IntoSimpleExpr for Expr
impl IntoSimpleExpr for Expr
§fn into_simple_expr(self) -> SimpleExpr
fn into_simple_expr(self) -> SimpleExpr
§impl PgExpr for Expr
impl PgExpr for Expr
§fn concatenate<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn concatenate<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
||
) expression. Read more§fn concat<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn concat<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
PgExpr::concatenate
§fn matches<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn matches<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
@@
) expression. Read more§fn contains<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn contains<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
@>
) expression. Read more§fn contained<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn contained<T>(self, expr: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
<@
) expression. Read more§fn ilike<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
fn ilike<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
ILIKE
expression. Read more§fn not_ilike<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
fn not_ilike<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
NOT ILIKE
expression§fn get_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn get_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
->
). Read more§fn cast_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn cast_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
->>
). Read more§impl SqliteExpr for Expr
impl SqliteExpr for Expr
§fn glob<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn glob<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
GLOB
operator. Read more§fn matches<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn matches<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
MATCH
operator. Read more§fn get_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn get_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
->
). Read more§fn cast_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
fn cast_json_field<T>(self, right: T) -> SimpleExprwhere
T: Into<SimpleExpr>,
->>
). Read moreAuto Trait Implementations§
impl Freeze for Expr
impl !RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl !UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> ExprTrait for Twhere
T: Into<SimpleExpr>,
impl<T> ExprTrait for Twhere
T: Into<SimpleExpr>,
§fn as_enum<N>(self, type_name: N) -> SimpleExprwhere
N: IntoIden,
fn as_enum<N>(self, type_name: N) -> SimpleExprwhere
N: IntoIden,
AS enum
expression. Read more§fn binary<O, R>(self, op: O, right: R) -> SimpleExpr
fn binary<O, R>(self, op: O, right: R) -> SimpleExpr
§fn cast_as<N>(self, type_name: N) -> SimpleExprwhere
N: IntoIden,
fn cast_as<N>(self, type_name: N) -> SimpleExprwhere
N: IntoIden,
CAST AS
expression. Read more§fn unary(self, op: UnOper) -> SimpleExpr
fn unary(self, op: UnOper) -> SimpleExpr
§fn add<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn add<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn and<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn between<A, B>(self, a: A, b: B) -> SimpleExpr
fn between<A, B>(self, a: A, b: B) -> SimpleExpr
BETWEEN
expression. Read more§fn div<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn div<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn eq<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn eq<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
=
) expression. Read more§fn equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
fn equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
§fn gt<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn gt<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
>
) expression. Read more§fn gte<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn gte<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
>=
) expression. Read more§fn in_subquery(self, sel: SelectStatement) -> SimpleExpr
fn in_subquery(self, sel: SelectStatement) -> SimpleExpr
IN
sub-query expression. Read more§fn in_tuples<V, I>(self, v: I) -> SimpleExprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
fn in_tuples<V, I>(self, v: I) -> SimpleExprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
IN
sub expression. Read more§fn is<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn is<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
IS
expression. Read more§fn is_in<V, I>(self, v: I) -> SimpleExpr
fn is_in<V, I>(self, v: I) -> SimpleExpr
IN
expression. Read more§fn is_not<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn is_not<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
IS NOT
expression. Read more§fn is_not_in<V, I>(self, v: I) -> SimpleExpr
fn is_not_in<V, I>(self, v: I) -> SimpleExpr
NOT IN
expression. Read more§fn is_not_null(self) -> SimpleExpr
fn is_not_null(self) -> SimpleExpr
IS NOT NULL
expression. Read more§fn is_null(self) -> SimpleExpr
fn is_null(self) -> SimpleExpr
IS NULL
expression. Read more§fn left_shift<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn left_shift<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
fn like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
LIKE
expression. Read more§fn lt<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn lt<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
<
) expression. Read more§fn lte<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn lte<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
<=
) expression. Read more§fn modulo<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn modulo<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn mul<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn mul<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn ne<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn ne<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
<>
) expression. Read more§fn not(self) -> SimpleExpr
fn not(self) -> SimpleExpr
NOT
. Read more§fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
NOT BETWEEN
expression. Read more§fn not_equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
fn not_equals<C>(self, col: C) -> SimpleExprwhere
C: IntoColumnRef,
§fn not_in_subquery(self, sel: SelectStatement) -> SimpleExpr
fn not_in_subquery(self, sel: SelectStatement) -> SimpleExpr
NOT IN
sub-query expression. Read more§fn not_like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
fn not_like<L>(self, like: L) -> SimpleExprwhere
L: IntoLikeExpr,
NOT LIKE
expression. Read more§fn or<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn or<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
OR
operation. Read more§fn right_shift<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn right_shift<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn sub<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn sub<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn bit_and<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn bit_and<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§fn bit_or<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
fn bit_or<R>(self, right: R) -> SimpleExprwhere
R: Into<SimpleExpr>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more