pub struct SetQuery { /* private fields */ }Expand description
集合运算查询,支持链式追加多个 SELECT 并以 UNION/INTERSECT/EXCEPT 连接。
§示例
ⓘ
use sz_orm_core::DbType;
use sz_orm_query_builder::Query;
let q1 = Query::select().column("id").from("active_users");
let q2 = Query::select().column("id").from("pending_users");
let sql = q1.union(q2).build(DbType::MySQL);
// SELECT `id` FROM `active_users` UNION SELECT `id` FROM `pending_users`Implementations§
Source§impl SetQuery
impl SetQuery
Sourcepub fn new(first: SelectQuery, op: SetOperator, second: SelectQuery) -> Self
pub fn new(first: SelectQuery, op: SetOperator, second: SelectQuery) -> Self
创建一个集合运算查询。
Sourcepub fn union(self, other: SelectQuery) -> Self
pub fn union(self, other: SelectQuery) -> Self
追加 UNION 查询。
Sourcepub fn union_all(self, other: SelectQuery) -> Self
pub fn union_all(self, other: SelectQuery) -> Self
追加 UNION ALL 查询。
Sourcepub fn intersect(self, other: SelectQuery) -> Self
pub fn intersect(self, other: SelectQuery) -> Self
追加 INTERSECT 查询。
Sourcepub fn except(self, other: SelectQuery) -> Self
pub fn except(self, other: SelectQuery) -> Self
追加 EXCEPT 查询。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SetQuery
impl RefUnwindSafe for SetQuery
impl Send for SetQuery
impl Sync for SetQuery
impl Unpin for SetQuery
impl UnsafeUnpin for SetQuery
impl UnwindSafe for SetQuery
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