SelectBuilder

Struct SelectBuilder 

Source
pub struct SelectBuilder { /* private fields */ }

Implementations§

Source§

impl SelectBuilder

Source

pub fn new() -> Self

Source

pub fn set_flavor(&mut self, flavor: Flavor) -> Flavor

Source

pub fn flavor(&self) -> Flavor

Source

pub fn with(&mut self, cte: &CTEBuilder) -> &mut Self

Source

pub fn where_clause(&self) -> Option<WhereClauseRef>

返回当前 WhereClause(可用于跨 builder 共享)。

Source

pub fn set_where_clause(&mut self, wc: Option<WhereClauseRef>) -> &mut Self

设置/共享 WhereClause(对齐 go-sqlbuilder 公开字段 WhereClause 的用法)。

  • None 等价于清空 WHERE。
  • Some(wc) 会把该 WhereClause 绑定到当前 builder,并确保内部 placeholder 指向正确的 builder。
Source

pub fn clear_where_clause(&mut self) -> &mut Self

Source

pub fn add_where_expr( &mut self, args: ArgsRef, exprs: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

AddWhereExpr:允许显式指定 ArgsRef,把表达式追加到 WhereClause(对齐 go-sqlbuilder)。

Source

pub fn clone_builder(&self) -> Self

Source

pub fn select( &mut self, cols: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn select_more( &mut self, cols: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn distinct(&mut self) -> &mut Self

Source

pub fn from( &mut self, tables: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn join( &mut self, table: impl Into<String>, on_expr: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn join_with_option( &mut self, option: Option<JoinOption>, table: impl Into<String>, on_expr: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn where_( &mut self, and_expr: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn add_where_clause(&mut self, other: &WhereClause) -> &mut Self

Source

pub fn add_where_clause_ref(&mut self, other: &WhereClauseRef) -> &mut Self

Source

pub fn having( &mut self, and_expr: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn group_by( &mut self, cols: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn order_by( &mut self, cols: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Source

pub fn order_by_asc(&mut self, col: impl Into<String>) -> &mut Self

Source

pub fn order_by_desc(&mut self, col: impl Into<String>) -> &mut Self

Source

pub fn asc(&mut self) -> &mut Self

Source

pub fn desc(&mut self) -> &mut Self

Source

pub fn limit(&mut self, limit: i64) -> &mut Self

Source

pub fn offset(&mut self, offset: i64) -> &mut Self

Source

pub fn for_update(&mut self) -> &mut Self

Source

pub fn for_share(&mut self) -> &mut Self

Source

pub fn as_(&self, name: &str, alias: &str) -> String

Source

pub fn builder_as(&self, builder: impl Builder + 'static, alias: &str) -> String

Source

pub fn sql(&mut self, sql: impl Into<String>) -> &mut Self

Methods from Deref<Target = Cond>§

Source

pub fn var(&self, value: impl Into<Arg>) -> String

Var:把值放进 Args,返回 $n 占位符。

Source

pub fn equal(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn e(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn eq(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn not_equal(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn ne(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn neq(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn greater_than(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn g(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn gt(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn greater_equal_than(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn ge(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn gte(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn less_than(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn l(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn lt(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn less_equal_than(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn le(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn lte(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn like(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn ilike(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn not_like(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn not_ilike(&self, field: &str, value: impl Into<Arg>) -> String

Source

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

Source

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

Source

pub fn between( &self, field: &str, lower: impl Into<Arg>, upper: impl Into<Arg>, ) -> String

Source

pub fn not_between( &self, field: &str, lower: impl Into<Arg>, upper: impl Into<Arg>, ) -> String

Source

pub fn in_( &self, field: &str, values: impl IntoIterator<Item = impl Into<Arg>>, ) -> String

Source

pub fn not_in( &self, field: &str, values: impl IntoIterator<Item = impl Into<Arg>>, ) -> String

Source

pub fn or(&self, exprs: impl IntoIterator<Item = impl Into<String>>) -> String

Source

pub fn and(&self, exprs: impl IntoIterator<Item = impl Into<String>>) -> String

Source

pub fn not(&self, expr: impl Into<String>) -> String

Source

pub fn exists(&self, subquery: impl Into<Arg>) -> String

Source

pub fn not_exists(&self, subquery: impl Into<Arg>) -> String

Source

pub fn any( &self, field: &str, op: &str, values: impl IntoIterator<Item = impl Into<Arg>>, ) -> String

Source

pub fn all( &self, field: &str, op: &str, values: impl IntoIterator<Item = impl Into<Arg>>, ) -> String

Source

pub fn some( &self, field: &str, op: &str, values: impl IntoIterator<Item = impl Into<Arg>>, ) -> String

Source

pub fn is_distinct_from(&self, field: &str, value: impl Into<Arg>) -> String

Source

pub fn is_not_distinct_from(&self, field: &str, value: impl Into<Arg>) -> String

Trait Implementations§

Source§

impl Builder for SelectBuilder

Source§

fn build_with_flavor( &self, flavor: Flavor, initial_arg: &[Arg], ) -> (String, Vec<Arg>)

Source§

fn flavor(&self) -> Flavor

Source§

fn build(&self) -> (String, Vec<Arg>)

Source§

impl Clone for SelectBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SelectBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SelectBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for SelectBuilder

Source§

type Target = Cond

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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 = 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.