unmbt/ciallo-orm/ast does not have a README file

    AggFunc

    pub(all) enum AggFunc {
    Count
    Sum
    Avg
    Min
    Max
    } derive(Eq,
    Debug
    )

    BinaryOp

    pub(all) enum BinaryOp {
    Eq
    Ne
    Lt
    Lte
    Gt
    Gte
    Like
    ILike
    Add
    Sub
    Mul
    Div
    } derive(Eq,
    Debug
    )

    Col

    pub struct Col[Table, Val] {
    table : String
    alias_ : String?
    name : String
    nullable : Bool
    // private fields
    }

    带幽灵类型(Table, Val)的强类型列描述符
    impl Eq for Col[Table, Val]
    impl Debug for Col[Table, Val]

    Col::Col

    fn[Table, Val] Col::Col(table~ : String, name~ : String, alias_? : String, nullable? : Bool) -> Col[Table, Val]

    Col::as_nullable

    fn[Table, Val] Col::as_nullable(self : Col[Table, Val]) -> Col[Table, Val?]

    LEFT JOIN 可空性提升:将 Col[Table, Val] 提升为 Col[Table, Val?]

    Col::asc

    fn[Table, Val] Col::asc(self : Col[Table, Val]) -> OrderBy

    Col::between

    fn[Table, Val :
    ToSqlValue
    ] Col::between(self : Col[Table, Val], low : Val, high : Val) -> Expr

    Col::contains

    fn[Table] Col::contains(self : Col[Table, String], sub : String) -> Expr

    Col::desc

    fn[Table, Val] Col::desc(self : Col[Table, Val]) -> OrderBy

    Col::ends_with

    fn[Table] Col::ends_with(self : Col[Table, String], suffix : String) -> Expr

    Col::eq

    fn[Table, Val :
    ToSqlValue
    ] Col::eq(self : Col[Table, Val], value : Val) -> Expr

    Col::eq_col

    fn[TableA, TableB, Val] Col::eq_col(self : Col[TableA, Val], other : Col[TableB, Val]) -> Expr

    Col::gt

    fn[Table, Val :
    ToSqlValue
    ] Col::gt(self : Col[Table, Val], value : Val) -> Expr

    Col::gte

    fn[Table, Val :
    ToSqlValue
    ] Col::gte(self : Col[Table, Val], value : Val) -> Expr

    Col::in_list

    fn[Table, Val :
    ToSqlValue
    ] Col::in_list(self : Col[Table, Val], values : Array[Val]) -> Expr

    Col::is_not_null

    fn[Table, Val] Col::is_not_null(self : Col[Table, Val?]) -> Expr

    Col::is_null

    fn[Table, Val] Col::is_null(self : Col[Table, Val?]) -> Expr

    Col::lt

    fn[Table, Val :
    ToSqlValue
    ] Col::lt(self : Col[Table, Val], value : Val) -> Expr

    Col::lte

    fn[Table, Val :
    ToSqlValue
    ] Col::lte(self : Col[Table, Val], value : Val) -> Expr

    Col::ne

    fn[Table, Val :
    ToSqlValue
    ] Col::ne(self : Col[Table, Val], value : Val) -> Expr

    Col::not_in_list

    fn[Table, Val :
    ToSqlValue
    ] Col::not_in_list(self : Col[Table, Val], values : Array[Val]) -> Expr

    Col::starts_with

    fn[Table] Col::starts_with(self : Col[Table, String], prefix : String) -> Expr

    Col::to_expr

    fn[Table, Val] Col::to_expr(self : Col[Table, Val]) -> Expr

    ConflictAction

    pub(all) enum ConflictAction {
    DoNothing
    DoUpdate(set_columns~ : Array[String])
    } derive(Eq,
    Debug
    )

    DeleteAst

    pub(all) struct DeleteAst {
    table : String
    soft_delete_col : String?
    tenant_col : String?
    where_clause : Expr?
    returning : Array[String]
    } derive(Eq,
    Debug
    )

    DeleteAst::DeleteAst

    fn DeleteAst::DeleteAst(table~ : String, soft_delete_col? : String, tenant_col? : String, where_clause? : Expr, returning? : Array[String]) -> DeleteAst

    Expr

    pub(all) enum Expr {
    Raw(sql~ : String, params~ : Array[
    SqlValue
    ])
    Column(table~ : String, name~ : String)
    Param(
    SqlValue
    )
    Binary(left~ : Expr, op~ : BinaryOp, right~ : Expr)
    Unary(op~ : UnaryOp, expr~ : Expr)
    InList(expr~ : Expr, values~ : Array[
    SqlValue
    ], negated~ : Bool)
    Between(expr~ : Expr, low~ :
    SqlValue
    , high~ :
    SqlValue
    )
    And(Array[Expr])
    Or(Array[Expr])
    Not(Expr)
    Agg(func~ : AggFunc, expr~ : Expr?)
    } derive(Eq,
    Debug
    )

    SQL 布尔条件与标量表达式 AST

    Expr::and_

    fn Expr::and_(self : Expr, other : Expr) -> Expr

    Expr::not_

    fn Expr::not_(self : Expr) -> Expr

    Expr::or_

    fn Expr::or_(self : Expr, other : Expr) -> Expr

    InsertAst

    pub(all) struct InsertAst {
    table : String
    tenant_col : String?
    columns : Array[String]
    values : Array[Array[
    SqlValue
    ]]
    on_conflict : OnConflict?
    returning : Array[String]
    } derive(Eq,
    Debug
    )

    InsertAst::InsertAst

    fn InsertAst::InsertAst(table~ : String, columns~ : Array[String], values~ : Array[Array[
    SqlValue
    ]], tenant_col? : String, on_conflict? : OnConflict, returning? : Array[String]) -> InsertAst

    JoinClause

    pub(all) struct JoinClause {
    kind : JoinKind
    table : String
    alias_ : String?
    on : Expr
    } derive(Eq,
    Debug
    )

    JoinKind

    pub(all) enum JoinKind {
    Inner
    Left
    Right
    Full
    } derive(Eq,
    Debug
    )

    OnConflict

    pub(all) struct OnConflict {
    target_columns : Array[String]
    action : ConflictAction
    } derive(Eq,
    Debug
    )

    OrderBy

    pub(all) struct OrderBy {
    expr : Expr
    dir : SortDir
    } derive(Eq,
    Debug
    )

    Patch

    pub(all) enum Patch[T] {
    Keep
    Set(T)
    Clear
    } derive(Eq,
    Debug
    )

    部分更新三态值(Keep 忽略该列 / Set 更新值 / Clear 显式置 NULL)

    Projection

    pub struct Projection[Val] {
    expr : Expr
    alias_ : String?
    // private fields
    }

    带类型投影包装器(供 select1 / select2 / select3 元组投影)
    impl Eq for Projection[Val]

    Projection::Projection

    fn[Val] Projection::Projection(expr~ : Expr, alias_? : String) -> Projection[Val]

    SelectAst

    pub(all) struct SelectAst {
    columns : Array[SelectColumn]
    from_table : String
    from_alias : String?
    soft_delete_col : String?
    tenant_col : String?
    joins : Array[JoinClause]
    where_clause : Expr?
    group_by : Array[Expr]
    having : Expr?
    order_by : Array[OrderBy]
    limit : Int?
    offset : Int?
    distinct : Bool
    } derive(Eq,
    Debug
    )

    SelectAst::SelectAst

    fn SelectAst::SelectAst(from_table~ : String, from_alias? : String, columns? : Array[SelectColumn], soft_delete_col? : String, tenant_col? : String, joins? : Array[JoinClause], where_clause? : Expr, group_by? : Array[Expr], having? : Expr, order_by? : Array[OrderBy], limit? : Int, offset? : Int, distinct? : Bool) -> SelectAst

    SelectColumn

    pub(all) struct SelectColumn {
    expr : Expr
    alias_ : String?
    } derive(Eq,
    Debug
    )

    SortDir

    pub(all) enum SortDir {
    Asc
    Desc
    } derive(Eq,
    Debug
    )

    TableRef

    pub struct TableRef[Table] {
    name : String
    alias_ : String?
    soft_delete_col : String?
    tenant_col : String?
    version_col : String?
    // private fields
    }

    强类型表描述符(含软删除、多租户、乐观锁元数据列)
    impl Eq for TableRef[Table]
    impl Debug for TableRef[Table]

    TableRef::TableRef

    fn[Table] TableRef::TableRef(name~ : String, alias_? : String, soft_delete_col? : String, tenant_col? : String, version_col? : String) -> TableRef[Table]

    TableRef::aliased

    fn[Table] TableRef::aliased(self : TableRef[Table], alias_ : String) -> TableRef[Table]

    TableRef::effective_name

    fn[Table] TableRef::effective_name(self : TableRef[Table]) -> String

    UnaryOp

    pub(all) enum UnaryOp {
    IsNull
    IsNotNull
    } derive(Eq,
    Debug
    )

    UpdateAst

    pub(all) struct UpdateAst {
    table : String
    tenant_col : String?
    version_col : String?
    expected_version : Int64?
    assignments : Array[(String, Expr)]
    where_clause : Expr?
    returning : Array[String]
    } derive(Eq,
    Debug
    )

    UpdateAst::UpdateAst

    fn UpdateAst::UpdateAst(table~ : String, assignments~ : Array[(String, Expr)], tenant_col? : String, version_col? : String, expected_version? : Int64, where_clause? : Expr, returning? : Array[String]) -> UpdateAst

    and_all

    fn and_all(conds : Array[Expr?]) -> Expr?

    avg_f64

    fn[Table] avg_f64(col : Col[Table, Int64]) -> Projection[Double?]

    col_proj

    fn[Table, Val] col_proj(col : Col[Table, Val], alias_? : String) -> Projection[Val]

    count

    fn[Table, Val] count(col : Col[Table, Val]) -> Projection[Int64]

    count_all

    fn count_all() -> Projection[Int64]

    or_all

    fn or_all(conds : Array[Expr?]) -> Expr?

    sum_i64

    fn[Table] sum_i64(col : Col[Table, Int64]) -> Projection[Int64?]

    Source Files