mirror of
https://github.com/djhackersdev/minime.git
synced 2026-03-21 17:54:13 -05:00
types/sql-bricks-postgres: Add initial typings
This commit declares and type-checks the following clauses: * limit().offset() chains on SelectStatement * onConflict().doUpdate() chains on InsertStatement We need to flesh out the other possibilities for onConflict() in particular before all these changes get submitted as an upstream PR.
This commit is contained in:
parent
691841187b
commit
2ccd9dc382
30
types/sql-bricks-postgres/index.d.ts
vendored
Normal file
30
types/sql-bricks-postgres/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
declare module "sql-bricks-postgres" {
|
||||
import * as sql from "sql-bricks";
|
||||
export * from "sql-bricks";
|
||||
|
||||
interface OnConflictClause {
|
||||
doUpdate(colNames: string[]): sql.Statement;
|
||||
}
|
||||
|
||||
interface LimitClause extends sql.SelectStatement {
|
||||
offset(value: number): sql.Statement;
|
||||
}
|
||||
|
||||
export interface PgInsertStatement extends sql.InsertStatement {
|
||||
onConflict(...colNames: string[]): OnConflictClause;
|
||||
}
|
||||
|
||||
export interface PgSelectStatement extends sql.SelectStatement {
|
||||
limit(value: number): LimitClause;
|
||||
}
|
||||
|
||||
export interface PgSqlBricksFn extends sql.SqlBricksFn {
|
||||
insert(tbl?: string, ...values: any[]): PgInsertStatement;
|
||||
|
||||
select(...columns: Array<string | sql.SelectStatement>): PgSelectStatement;
|
||||
select(columns: string[] | sql.SelectStatement[]): PgSelectStatement;
|
||||
}
|
||||
|
||||
const PgSqlBricks: PgSqlBricksFn;
|
||||
export default PgSqlBricks;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user