Type ref to generics param Db only, do NOT access as variable!
For table joint
{
tb_user: {
tbUserUid: "tb_user.uid",
tbUserName: "tb_user.name",
...
},
tb_user_detail: {
tbUserDetailUid: "tb_user_detail.uid"
},
...,
}
Columns mapping object, tb_name w/o table prefix
{
tb_name: { col_alias: "col_name", ..., }
}
Columns mapping object, column name with table prefix, eg tb_foo.user
{
tb_user: {
uid: "tb_user.uid",
name: "tb_user.name",
...
},
tb_user_detail: {...},
...,
}
Tables alias/name pairs { tb_name: "tb_name" }
Generated using TypeDoc
Generate knex method refer to tables. method name from keyof T, ReturnType is the type according to the key, props both enumerable and unenumerable.
T = { user: {id: number, name: string} } will get db.user() => Knex.QueryBuilder<{id: number, name: string}>