Sign in

    oboard/morm/engine does not have a README file

    Engine

    pub(open) trait Engine {
    async page(Self, query : &QueryBuilder, pageable : Pageable) -> QueryResult
    async page_raw(Self, sql : String, params : FixedArray[Param], pageable : Pageable) -> QueryResult
    async exec(Self, query : &QueryBuilder) -> QueryResult
    async exec_raw(Self, sql : String, params : FixedArray[Param]) -> QueryResult
    async migrate_table(Self, table_schema :
    Table
    ) -> QueryResult
    close(Self) -> Unit
    }

    FromParam

    pub(open) trait FromParam {
    from_param(Param) -> Self raise ParamDecodeError
    }

    impl FromParam for Unit
    impl FromParam for Bool
    impl FromParam for Byte
    impl FromParam for Int
    impl FromParam for Int16
    impl FromParam for Int64
    impl FromParam for UInt
    impl FromParam for UInt16
    impl FromParam for UInt64
    impl FromParam for Float
    impl FromParam for Double
    impl FromParam for String
    impl FromParam for Option[T]
    impl FromParam for Bytes
    impl FromParam for Json

    QueryBuilder

    pub(open) trait QueryBuilder {
    to_query(Self) -> Query
    }

    ToParam

    pub(open) trait ToParam {
    to_param(Self) -> Param
    }

    impl ToParam for Unit
    impl ToParam for Bool
    impl ToParam for Byte
    impl ToParam for Int
    impl ToParam for Int16
    impl ToParam for Int64
    impl ToParam for UInt
    impl ToParam for UInt16
    impl ToParam for UInt64
    impl ToParam for Float
    impl ToParam for Double
    impl ToParam for String
    impl ToParam for Bytes
    impl ToParam for Json
    impl ToParam for Map[String, Param]

    ParamDecodeError

    pub(all) suberror ParamDecodeError {
    ParamDecodeError(String)
    } derive(Eq, ToJson)

    ConnectionPool

    pub(all) struct ConnectionPool[C] {
    idle :
    Queue
    [C]
    permits :
    Semaphore

    closed : Bool
    }

    ConnectionPool::borrow

    async fn[C] ConnectionPool::borrow(self : ConnectionPool[C], open_conn : async () -> Result[C, String]) -> Result[C, String]

    ConnectionPool::close

    fn[C] ConnectionPool::close(self : ConnectionPool[C], close_conn : (C) -> Unit) -> Unit

    ConnectionPool::new

    fn[C] ConnectionPool::new(max_open : Int, max_idle? : Int) -> ConnectionPool[C]

    ConnectionPool::release

    fn[C] ConnectionPool::release(self : ConnectionPool[C], conn : C, close_conn : (C) -> Unit, reusable? : Bool) -> Unit

    DeleteStatement

    pub(all) struct DeleteStatement {
    from : String
    where_ : FixedArray[Where]
    } derive(Eq, ToJson,
    FromJson
    )

    InsertStatement

    pub(all) struct InsertStatement {
    into : String
    columns : FixedArray[String]
    values : FixedArray[Param]
    rows : FixedArray[FixedArray[Param]]
    } derive(Eq, ToJson,
    FromJson
    )

    OrderBy

    pub(all) enum OrderBy {
    Asc(String)
    Desc(String)
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for OrderBy

    Page

    pub(all) struct Page[T] {
    content : FixedArray[T]
    total_elements : Int
    total_pages : Int
    number : Int
    size : Int
    first : Bool
    last : Bool
    empty : Bool
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for Page[T]
    impl FromParam for Page[T]

    Pageable

    pub(all) struct Pageable {
    page : Int
    size : Int
    sort : Sort?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    impl Show for Pageable

    Param

    pub(all) enum Param {
    Null
    Bool(Bool)
    Byte(Byte)
    Int(Int)
    Int16(Int16)
    UInt16(UInt16)
    UInt(UInt)
    UInt64(UInt64)
    Int64(Int64)
    BigInt(
    BigInt
    )
    Float(Float)
    Double(Double)
    Decimal(String)
    Date(
    PlainDate
    , String?)
    Time(
    PlainTime
    , String?)
    DateTime(
    PlainDateTime
    , String?)
    Timestamp(
    ZonedDateTime
    , String?)
    Uuid(String)
    Object(Map[String, Param])
    Json(Json)
    String(String)
    Bytes(Bytes)
    }

    impl Eq for Param
    impl Show for Param
    impl ToJson for Param
    impl FromParam for Param
    impl ToParam for Param

    Query

    pub(all) enum Query {
    Statement(Statement)
    Raw(String, FixedArray[Param])
    Tx(TxOp)
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for Query

    QueryResult

    pub(all) struct QueryResult {
    ok : Bool
    rows_affected : Int
    rows : FixedArray[Map[String, Param]]
    error : String?
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for QueryResult

    SelectStatement

    pub(all) struct SelectStatement {
    select : String
    from : String
    joins : FixedArray[String]
    where_ : FixedArray[Where]
    order_by : FixedArray[OrderBy]
    limit : Int?
    offset : Int?
    } derive(Eq, ToJson,
    FromJson
    )

    Set

    pub(all) struct Set {
    col : String
    value : Param
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for Set

    Sort

    pub(all) struct Sort {
    property : String
    direction : SortDirection
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    impl Show for Sort

    SortDirection

    pub(all) enum SortDirection {
    Asc
    Desc
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Statement

    pub(all) enum Statement {
    Select(SelectStatement)
    Insert(InsertStatement)
    Upsert(UpsertStatement)
    Update(UpdateStatement)
    Delete(DeleteStatement)
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for Statement

    TxOp

    pub(all) enum TxOp {
    Begin
    Commit
    Rollback
    Savepoint(String)
    RollbackToSavepoint(String)
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for TxOp

    UpdateStatement

    pub(all) struct UpdateStatement {
    table : String
    sets : FixedArray[Set]
    where_ : FixedArray[Where]
    } derive(Eq, ToJson,
    FromJson
    )

    UpsertStatement

    pub(all) struct UpsertStatement {
    table : String
    sets : FixedArray[Set]
    conflict_target : FixedArray[String]
    update_sets : FixedArray[Set]
    } derive(Eq, ToJson,
    FromJson
    )

    Where

    pub(all) struct Where {
    col : String
    value : Param
    ty : WhereType
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for Where

    WhereType

    pub(all) enum WhereType {
    Eq
    Ne
    Gt
    Lt
    Gte
    Lte
    Like
    } derive(Eq, ToJson,
    FromJson
    )

    impl Show for WhereType

    bytes_to_hex

    fn bytes_to_hex(data : Bytes) -> String

    decode_json_column

    fn decode_json_column(value : Json, storage : String) -> Json raise ParamDecodeError

    enum_from_param

    fn[T :
    FromJson
    ] enum_from_param(value : Param) -> T raise ParamDecodeError

    enum_to_param

    fn[T : ToJson] enum_to_param(value : T) -> Param raise ParamDecodeError

    format_plain_date

    fn format_plain_date(value :
    PlainDate
    , format : String?) -> String

    format_plain_date_time

    fn format_plain_date_time(value :
    PlainDateTime
    , format : String?) -> String

    format_plain_time

    fn format_plain_time(value :
    PlainTime
    , format : String?) -> String

    format_zoned_date_time

    fn format_zoned_date_time(value :
    ZonedDateTime
    , format : String?) -> String

    from_param

    fn[T : FromParam] from_param(value : Param) -> T raise ParamDecodeError

    param_from_json_value

    fn param_from_json_value(json : Json) -> Param

    param_row_from_json

    fn param_row_from_json(row : Json) -> Map[String, Param]

    preload_belongs_to_default

    async fn[E : Engine] preload_belongs_to_default(engine : E, sql : String, target_key : String, key_params : FixedArray[Param]) -> Map[String, Json]

    preload_has_many_default

    async fn[E : Engine] preload_has_many_default(engine : E, sql : String, target_key : String, key_params : FixedArray[Param]) -> Map[String, Array[Json]]

    preload_in_sql_dollar

    fn preload_in_sql_dollar(table : String, key_col : String, count : Int) -> String

    preload_in_sql_qmark

    fn preload_in_sql_qmark(table : String, key_col : String, count : Int) -> String

    preload_many_to_many_default

    async fn[E : Engine] preload_many_to_many_default(engine : E, sql : String, key_params : FixedArray[Param]) -> Map[String, Array[Json]]

    preload_many_to_many_sql_dollar

    fn preload_many_to_many_sql_dollar(target_table : String, target_key : String, join_table : String, join_owner_key : String, join_target_key : String, count : Int) -> String

    preload_many_to_many_sql_qmark

    fn preload_many_to_many_sql_qmark(target_table : String, target_key : String, join_table : String, join_owner_key : String, join_target_key : String, count : Int) -> String

    render_default_sql

    fn render_default_sql(stmt : Statement) -> (String, FixedArray[Param])

    Default renderer (MySQL/Sqlite style placeholders and upsert syntax).

    render_query_sql

    fn render_query_sql(query : &QueryBuilder) -> (String, FixedArray[Param])

    to_param

    fn[T : ToParam] to_param(value : T) -> Param