ciallo-gen

    Compile-time code generator for unmbt/ciallo (#ciallo.schema, OpenAPI Eden SDK, #orm.*, wire DI, and migrate CLI)

    codegen
    openapi
    rpc
    ciallo
    Download zip
    Author
    Version
    0.3.0
    License
    MIT
    Last updated
    5 hours ago
    Downloads
    14

    #unmbt/ciallo-gen

    Compile-time code generator for unmbt/ciallo: #ciallo.schema -> impl @schema.Schema and OpenAPI 3.1 -> ciallo-eden TypeScript & MoonBit RPC SDKs.

    GenError

    pub(all) suberror GenError {
    InvalidSource(file~ : String, line~ : Int, message~ : String)
    UnsupportedConstruct(file~ : String, line~ : Int, message~ : String)
    InvalidOpenApi(String)
    DriftDetected(path~ : String)
    } derive(Eq,
    Debug
    )

    ProviderSpec

    pub(all) struct ProviderSpec {
    file : String
    line : Int
    fn_name : String
    is_async : Bool
    params : Array[(String, String)]
    labelled_params : Array[Bool]
    return_type : String
    } derive(Eq,
    Debug
    )

    extract_orm_snapshot

    fn extract_orm_snapshot(source : String, file_name? : String) ->
    SchemaSnapshot
    raise GenError

    从带 #orm.table / #orm.entity 注解的 MoonBit 源码提取 SchemaSnapshot(含索引、外键与复合主键)

    generate_eden_mbt

    fn generate_eden_mbt(openapi_json :
    Json
    ) -> String raise GenError

    generate_eden_ts

    fn generate_eden_ts(openapi_json :
    Json
    ) -> String raise GenError

    generate_orm_source

    fn generate_orm_source(source : String, file_name? : String) -> String raise GenError

    编译期生成 #orm.table / #orm.entity 与 #orm.sql 对应的零反射 ORM 绑定代码 (TableRef / Col / FromRow / UserQueries[E] 全套 CRUD+分页 / 自定义外键预加载 / 参数校验)

    generate_schema_source

    fn generate_schema_source(source : String, file_name? : String) -> String raise GenError

    generate_wire_source

    fn generate_wire_source(files : Array[(String, String)], wire_fn_name? : String) -> String raise GenError

    Compile-time static DI topological sort + cycle detection + zero-reflection container wiring.

    introspect_snapshot_to_mbt

    fn introspect_snapshot_to_mbt(snapshot :
    SchemaSnapshot
    ) -> String

    DB-first 逆向建模:将 SchemaSnapshot 反向生成干净的带 #orm.table 注解的 MoonBit Struct(严格遵守 ADR-013 规范拼写)

    parse_wire_providers

    fn parse_wire_providers(files : Array[(String, String)]) -> Array[ProviderSpec] raise GenError

    Scans all #ciallo.provider functions across package files using moonbitlang/parser AST (deterministically ordered by filename; automatically skips *_test.mbt and generated files).