#[non_exhaustive]pub enum Condition {
Show 39 variants
Eq(String, SqlValue),
Ne(String, SqlValue),
Gt(String, SqlValue),
Lt(String, SqlValue),
Gte(String, SqlValue),
Lte(String, SqlValue),
In(String, Vec<SqlValue>),
NotIn(String, Vec<SqlValue>),
Between(String, SqlValue, SqlValue),
Like(String, String),
ILike(String, String),
NotILike(String, String),
RegexMatch(String, String),
RegexIMatch(String, String),
NotRegexMatch(String, String),
NotRegexIMatch(String, String),
IsDistinctFrom(String, SqlValue),
IsNotDistinctFrom(String, SqlValue),
IsNull(String),
IsNotNull(String),
ColumnComparison(String, ComparisonOperator, String),
Exists(Box<Subquery>),
NotExists(Box<Subquery>),
InSubquery(String, Box<Subquery>),
FieldExpr(String, ComparisonOperator, SqlExpr),
JsonContains(String, SqlValue),
JsonContainedBy(String, SqlValue),
JsonHasKey(String, String),
Any(String, SqlValue),
All(String, SqlValue),
RangeContains(String, SqlValue),
RangeOverlaps(String, SqlValue),
JsonPathExists(String, String),
JsonPathMatch(String, String, SqlValue),
FullText(String, String),
FullTextQuery(String, String),
Not(Box<Condition>),
And(Vec<Condition>),
Or(Vec<Condition>),
}Expand description
查询条件(PostgreSQL)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Eq(String, SqlValue)
相等
Ne(String, SqlValue)
不等
Gt(String, SqlValue)
大于
Lt(String, SqlValue)
小于
Gte(String, SqlValue)
大于等于
Lte(String, SqlValue)
小于等于
In(String, Vec<SqlValue>)
IN 条件
NotIn(String, Vec<SqlValue>)
NOT IN 条件
Between(String, SqlValue, SqlValue)
BETWEEN 条件
Like(String, String)
LIKE 条件
ILike(String, String)
大小写不敏感 LIKE 条件(ILIKE)。
NotILike(String, String)
大小写不敏感 LIKE 取反(NOT ILIKE)。
RegexMatch(String, String)
POSIX 正则匹配(~)。
RegexIMatch(String, String)
大小写不敏感 POSIX 正则匹配(~*)。
NotRegexMatch(String, String)
POSIX 正则不匹配(!~)。
NotRegexIMatch(String, String)
大小写不敏感 POSIX 正则不匹配(!~*)。
IsDistinctFrom(String, SqlValue)
NULL-safe 不相等(IS DISTINCT FROM)。
IsNotDistinctFrom(String, SqlValue)
NULL-safe 相等(IS NOT DISTINCT FROM)。
IsNull(String)
IS NULL 条件
IsNotNull(String)
IS NOT NULL 条件
ColumnComparison(String, ComparisonOperator, String)
两个标识符之间的受控比较。
Exists(Box<Subquery>)
EXISTS 子查询。
NotExists(Box<Subquery>)
NOT EXISTS 子查询。
InSubquery(String, Box<Subquery>)
IN 子查询。
FieldExpr(String, ComparisonOperator, SqlExpr)
字段与受控服务端表达式的比较(如 updated_at < now())。
JsonContains(String, SqlValue)
JSON/JSONB 包含谓词:field @> $n(右值必须是 SqlValue::Json)。
JsonContainedBy(String, SqlValue)
JSON/JSONB 被包含谓词:field <@ $n(右值必须是 SqlValue::Json)。
JsonHasKey(String, String)
JSON/JSONB 顶层键存在谓词:field ? $n(键名以绑定参数传入)。
Any(String, SqlValue)
数组包含任一元素:field = ANY($n)(右值必须是 SqlValue::Array)。
All(String, SqlValue)
数组包含全部元素:field = ALL($n)(右值必须是 SqlValue::Array)。
RangeContains(String, SqlValue)
范围包含:field @> $n(右值必须是范围或多范围文本值)。
RangeOverlaps(String, SqlValue)
范围重叠:field && $n(右值必须是范围或多范围文本值)。
JsonPathExists(String, String)
JSONB 路径存在:jsonb_path_exists((field)::jsonb, $n::jsonpath)。
JsonPathMatch(String, String, SqlValue)
JSONB 路径谓词:jsonb_path_match((field)::jsonb, $n::jsonpath, $m::jsonb)。
FullText(String, String)
全文检索:to_tsvector('simple', field) @@ plainto_tsquery('simple', $n)。
FullTextQuery(String, String)
全文检索(to_tsquery 变体,允许布尔查询语法)。
Not(Box<Condition>)
NOT 包裹;渲染为 NOT (...)。
And(Vec<Condition>)
AND 组合
Or(Vec<Condition>)
OR 组合
Trait Implementations§
Auto Trait Implementations§
impl Forget for Condition
impl Freeze for Condition
impl Move for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnsafeUnpin for Condition
impl UnwindSafe for Condition
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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