Skip to main content

NotBuilder

Struct NotBuilder 

Source
pub struct NotBuilder { /* private fields */ }
Expand description

NOT 构建器 - 用于对单个过滤条件取反

通过 QueryBuilder::not() 创建,提供所有过滤条件方法 调用任意过滤方法会将生成的表达式用 Not 包裹后添加到查询中

Implementations§

Source§

impl NotBuilder

Source

pub fn expr(self, expr: FilterExpr) -> QueryBuilder

添加任意过滤表达式(复杂场景)

§示例
// 查询 NOT (age > 18 AND status = 'active')
db.query("users")
    .not()
    .expr(FilterExpr::And(
        Box::new(FilterExpr::Gt { field: "age".to_string(), value: DbValue::integer(18) }),
        Box::new(FilterExpr::Eq { field: "status".to_string(), value: DbValue::text("active") })
    ))
    .execute()?;
Source

pub fn eq(self, field: &str, value: DbValue) -> QueryBuilder

EQ 取反:不等于 (!=)

Source

pub fn ne(self, field: &str, value: DbValue) -> QueryBuilder

NE 取反:等于 (=)

Source

pub fn lt(self, field: &str, value: DbValue) -> QueryBuilder

LT 取反:大于等于 (>=)

Source

pub fn le(self, field: &str, value: DbValue) -> QueryBuilder

LE 取反:大于 (>)

Source

pub fn gt(self, field: &str, value: DbValue) -> QueryBuilder

GT 取反:小于等于 (<=)

Source

pub fn ge(self, field: &str, value: DbValue) -> QueryBuilder

GE 取反:小于 (<)

Source

pub fn in_list(self, field: &str, values: Vec<DbValue>) -> QueryBuilder

IN 取反:NOT IN

Source

pub fn contains(self, field: &str, value: &str) -> QueryBuilder

CONTAINS 取反:NOT LIKE

Source

pub fn is_null(self, field: &str) -> QueryBuilder

IS NULL 取反:IS NOT NULL

Source

pub fn is_not_null(self, field: &str) -> QueryBuilder

IS NOT NULL 取反:IS NULL

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.