Skip to main content

Condition

Enum Condition 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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§

Source§

impl Clone for Condition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Condition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more