pub type Subquery<'a, ET> = Subquery<'a, ET, DataKind>;Expand description
Subquery type alias for MySQL
MySQL 的 Subquery 类型别名
A complete subquery that can be appended to other queries. This type represents a fully constructed subquery that can be embedded in WHERE clauses, FROM clauses, or other parts of SQL statements.
可以附加到其他查询的完整子查询。此类型表示可以嵌入到 WHERE 子句、FROM 子句或其他 SQL 语句部分中的完全构造的子查询。
§Type Parameters
ET- The entity type that this subquery operates onET- 此子查询操作的实体类型
§Public Methods
table- Create a subquery with the default table namewith_table- Create a subquery with a custom table namecolumns- Add the default table to the subqueryfilter- Add WHERE condition to the subqueryjoin- Add JOIN clause to the subquerygroup_by- Add GROUP BY clause to the subqueryhaving- Add HAVING clause to the subqueryappend_to- Embed the subquery into a parent query builder
§公共方法
table- 创建带有默认表名的子查询with_table- 创建带有自定义表名的子查询columns- 向子查询中添加自定义表filter- 向子查询中添加 WHERE 条件join- 向子查询中添加 JOIN 子句group_by- 向子查询中添加 GROUP BY 子句having- 向子查询中添加 HAVING 子句append_to- 将子查询嵌入到父查询构建器中
§Examples
use kitx::mysql::builder::{Subquery, Select};
let subquery: Subquery<Article> = Subquery::table()
.columns(|b| {
b.push("AVG(views)");
})
.filter(|b| {
b.push("id > ").push_bind(3);
});Aliased Type§
pub struct Subquery<'a, ET> { /* private fields */ }