pub struct Db { /* private fields */ }Expand description
快捷查询入口(think-orm Db::name() 风格)
不要求定义 Model,仅靠表名 + 方言即可生成 SQL。
Implementations§
Source§impl Db
impl Db
Sourcepub fn where_cond(self, condition: impl Into<String>) -> Self
pub fn where_cond(self, condition: impl Into<String>) -> Self
WHERE 条件(AND)
Sourcepub fn where_between(
self,
field: impl Into<String>,
start: Value,
end: Value,
) -> Self
pub fn where_between( self, field: impl Into<String>, start: Value, end: Value, ) -> Self
WHERE BETWEEN
Sourcepub fn where_null(self, field: impl Into<String>) -> Self
pub fn where_null(self, field: impl Into<String>) -> Self
WHERE IS NULL
Sourcepub fn where_not_null(self, field: impl Into<String>) -> Self
pub fn where_not_null(self, field: impl Into<String>) -> Self
WHERE IS NOT NULL
Sourcepub fn order_desc(self, field: impl Into<String>) -> Self
pub fn order_desc(self, field: impl Into<String>) -> Self
ORDER BY field DESC
Sourcepub fn join_inner(
self,
table: impl Into<String>,
on_left: impl Into<String>,
on_right: impl Into<String>,
) -> Self
pub fn join_inner( self, table: impl Into<String>, on_left: impl Into<String>, on_right: impl Into<String>, ) -> Self
INNER JOIN
Sourcepub fn join_left(
self,
table: impl Into<String>,
on_left: impl Into<String>,
on_right: impl Into<String>,
) -> Self
pub fn join_left( self, table: impl Into<String>, on_left: impl Into<String>, on_right: impl Into<String>, ) -> Self
LEFT JOIN
Sourcepub fn join_right(
self,
table: impl Into<String>,
on_left: impl Into<String>,
on_right: impl Into<String>,
) -> Self
pub fn join_right( self, table: impl Into<String>, on_left: impl Into<String>, on_right: impl Into<String>, ) -> Self
RIGHT JOIN
Sourcepub fn build_select(&self) -> String
pub fn build_select(&self) -> String
构建 SELECT SQL
Sourcepub fn build_delete(&self) -> String
pub fn build_delete(&self) -> String
构建 DELETE SQL
Sourcepub fn build_count(&self) -> String
pub fn build_count(&self) -> String
构建 COUNT SQL
Sourcepub fn build_exists(&self) -> String
pub fn build_exists(&self) -> String
构建 EXISTS SQL
Auto Trait Implementations§
impl !RefUnwindSafe for Db
impl !UnwindSafe for Db
impl Freeze for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl UnsafeUnpin for Db
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