pub struct QueryWrapper<'a, T>where
T: DeserializeOwned + TableName,{
pub root_condition: ConditionNode<'a>,
pub order_by: Vec<OrderBy<'a>>,
pub group_by: Vec<Cow<'a, str>>,
pub having: Option<Cow<'a, str>>,
pub limit: Option<usize>,
pub offset: Option<usize>,
pub select_columns: Vec<Cow<'a, str>>,
pub custom_sql: Option<Cow<'a, str>>,
/* private fields */
}
Expand description
优化后的QueryWrapper结构体
Fields§
§root_condition: ConditionNode<'a>
§order_by: Vec<OrderBy<'a>>
§group_by: Vec<Cow<'a, str>>
§having: Option<Cow<'a, str>>
§limit: Option<usize>
§offset: Option<usize>
§select_columns: Vec<Cow<'a, str>>
§custom_sql: Option<Cow<'a, str>>
Implementations§
Source§impl<'a, T> QueryWrapper<'a, T>where
T: DeserializeOwned + TableName,
impl<'a, T> QueryWrapper<'a, T>where
T: DeserializeOwned + TableName,
Sourcepub fn like_right<F, V>(self, column: F, value: V) -> Self
pub fn like_right<F, V>(self, column: F, value: V) -> Self
右模糊匹配条件
Sourcepub fn is_not_null<F, V>(self, column: F) -> Self
pub fn is_not_null<F, V>(self, column: F) -> Self
不为空条件
Sourcepub fn not_between<F, V>(self, column: F, value1: V, value2: V) -> Self
pub fn not_between<F, V>(self, column: F, value1: V, value2: V) -> Self
不在范围内条件
Sourcepub fn order_by<F, V>(self, column: F, direction: OrderDirection) -> Self
pub fn order_by<F, V>(self, column: F, direction: OrderDirection) -> Self
设置排序条件
Sourcepub fn order_by_asc<F, V>(self, column: F) -> Self
pub fn order_by_asc<F, V>(self, column: F) -> Self
设置升序排序
Sourcepub fn order_by_desc<F, V>(self, column: F) -> Self
pub fn order_by_desc<F, V>(self, column: F) -> Self
设置降序排序
Sourcepub fn build_where_clause(&self) -> String
pub fn build_where_clause(&self) -> String
生成WHERE子句
Sourcepub fn build_order_by_clause(&self) -> String
pub fn build_order_by_clause(&self) -> String
生成ORDER BY子句
Sourcepub fn build_group_by_clause(&self) -> String
pub fn build_group_by_clause(&self) -> String
生成GROUP BY子句
Sourcepub fn build_having_clause(&self) -> String
pub fn build_having_clause(&self) -> String
生成HAVING子句
Sourcepub fn build_limit_offset_clause(&self) -> String
pub fn build_limit_offset_clause(&self) -> String
生成LIMIT和OFFSET子句
Sourcepub fn build_select_clause(&self) -> String
pub fn build_select_clause(&self) -> String
生成SELECT子句
Trait Implementations§
Source§impl<'a, T> Clone for QueryWrapper<'a, T>
impl<'a, T> Clone for QueryWrapper<'a, T>
Source§fn clone(&self) -> QueryWrapper<'a, T>
fn clone(&self) -> QueryWrapper<'a, T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, T> Debug for QueryWrapper<'a, T>
impl<'a, T> Debug for QueryWrapper<'a, T>
Source§impl<'a, T> Default for QueryWrapper<'a, T>
impl<'a, T> Default for QueryWrapper<'a, T>
Source§fn default() -> QueryWrapper<'a, T>
fn default() -> QueryWrapper<'a, T>
Returns the “default value” for a type. Read more
Source§impl<'a, T> Wrapper<T> for QueryWrapper<'_, T>where
T: DeserializeOwned + TableName,
impl<'a, T> Wrapper<T> for QueryWrapper<'_, T>where
T: DeserializeOwned + TableName,
fn generate_sql(&self) -> String
Auto Trait Implementations§
impl<'a, T> Freeze for QueryWrapper<'a, T>
impl<'a, T> RefUnwindSafe for QueryWrapper<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for QueryWrapper<'a, T>where
T: Send,
impl<'a, T> Sync for QueryWrapper<'a, T>where
T: Sync,
impl<'a, T> Unpin for QueryWrapper<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for QueryWrapper<'a, T>where
T: UnwindSafe,
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