Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "kmore/src/lib/index"

Index

Functions

Functions

kmore

  • kmore<D, Dict>(kmoreOpts: KmoreOpts, dbDict?: DbDictBase<D> | DbDict<D> | void | null | false): Kmore<D, Dict>
  • Knex factory with type-safe tables accessor

    description

    D = { user: {id: number, name: string} } Initialize db connection and generate type-safe tables accessor (name and builder) will get

    • db.dbh : the connection instance of knex eg. db.dbh('tb_other').select()
    • db.tables : tables name accessor containing table key/value paris
    • db.columns : table column names accessor containing table key/value paris
    • db.scopedColumns : table column names accessor containing table key/value paris, with table prefix
    • db.rb : tables builder accessor, eg. db.rb.user() => Knex.QueryBuilder<{id: number, name: string}> tables will be generated from generics automaitically when passing undefined or null value

    Type parameters

    • D: DbModel

    • Dict: DbDictModel | void = void

    Parameters

    • kmoreOpts: KmoreOpts
    • Optional dbDict: DbDictBase<D> | DbDict<D> | void | null | false

    Returns Kmore<D, Dict>

Generated using TypeDoc