pub struct Chain { /* private fields */ }Expand description
条件链。
Implementations§
Source§impl Chain
impl Chain
pub fn new() -> Self
pub fn add_condition(self, condition: Condition) -> Self
pub fn equal( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
Sourcepub fn value_fn(
self,
f: impl Fn() -> ConditionValue + Send + Sync + 'static,
) -> Self
pub fn value_fn( self, f: impl Fn() -> ConditionValue + Send + Sync + 'static, ) -> Self
Set value_fn on the last condition (higher priority than explicit value), similar to Go’s WithValueFunc.
Sourcepub fn skip(self, skip: bool) -> Self
pub fn skip(self, skip: bool) -> Self
Set skip on the last condition, similar to Go’s WithSkip.
Sourcepub fn skip_fn(self, f: impl Fn() -> bool + Send + Sync + 'static) -> Self
pub fn skip_fn(self, f: impl Fn() -> bool + Send + Sync + 'static) -> Self
Set skip_fn on the last condition (higher priority than skip), similar to Go’s WithSkipFunc.
pub fn equal_opts( self, field: impl Into<String>, value: impl Into<ConditionValue>, opts: ChainOptions, ) -> Self
pub fn not_equal( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn is_null(self, field: impl Into<String>) -> Self
pub fn is_not_null(self, field: impl Into<String>) -> Self
pub fn greater_than( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn less_than( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn greater_equal_than( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn less_equal_than( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn like( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn not_like( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn between( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn in_( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn not_in( self, field: impl Into<String>, value: impl Into<ConditionValue>, ) -> Self
pub fn or( self, fields: impl IntoIterator<Item = impl Into<String>>, operators: impl IntoIterator<Item = Operator>, values: impl IntoIterator<Item = impl Into<ConditionValue>>, opts: ChainOptions, ) -> Self
pub fn order_by(self, value: impl Into<ConditionValue>) -> Self
pub fn order_by_desc(self, field: impl Into<String>) -> Self
pub fn order_by_asc(self, field: impl Into<String>) -> Self
pub fn limit(self, value: impl Into<ConditionValue>) -> Self
pub fn offset(self, value: impl Into<ConditionValue>) -> Self
pub fn page(self, page: i64, page_size: i64) -> Self
pub fn group_by(self, field: impl Into<String>) -> Self
pub fn join( self, option: JoinOption, table: impl Into<String>, on_expr: impl IntoIterator<Item = impl Into<String>>, ) -> Self
pub fn where_clause(self, wc: WhereClauseRef) -> Self
pub fn build(self) -> Vec<Condition>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chain
impl !RefUnwindSafe for Chain
impl !Send for Chain
impl !Sync for Chain
impl Unpin for Chain
impl !UnwindSafe for Chain
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
Mutably borrows from an owned value. Read more