db/db.ts
Star 9cd64d91d0 add SetSSKey
add makeInKeys
2024-10-27 00:36:18 +08:00

87 lines
2.6 KiB
TypeScript

// just for develop
export default {
get,
setDefault,
make,
query,
query1,
query11,
exec,
insert,
replace,
update,
delete: delete_,
destroy,
begin,
makeInKeys,
}
function get(dbName: string): DB { return null as any }
function setDefault(dbName: string): void { }
function make(descFileOrContent: string): Array<Object> { return null as any }
function query(sql: string, ...args: any): QueryResult { return null as any }
function query1(sql: string, ...args: any): QueryResult1 { return null as any }
function query11(sql: string, ...args: any): QueryResult11 { return null as any }
function exec(sql: string, ...args: any): ExecResult { return null as any }
function insert(table: string, data: Object): ExecResult { return null as any }
function replace(table: string, data: Object): ExecResult { return null as any }
function update(table: string, data: Object, where: string, ...args: any): ExecResult { return null as any }
function delete_(table: string, where: string, ...args: any): ExecResult { return null as any }
function destroy(): void { }
function begin(): Tx { return null as any }
function makeInKeys(numKeys: number): string { return '' }
interface DB {
make(descFileOrContent: string): Array<Object>
query(sql: string, ...args: any): QueryResult
query1(sql: string, ...args: any): QueryResult1
query11(sql: string, ...args: any): QueryResult11
exec(sql: string, ...args: any): ExecResult
insert(table: string, data: Object): ExecResult
replace(table: string, data: Object): ExecResult
update(table: string, data: Object, where: string, ...args: any): ExecResult
delete(table: string, where: string, ...args: any): ExecResult
destroy(): void
begin(): Tx
makeInKeys(numKeys: number): string
}
interface Tx {
query(sql: string, ...args: any): QueryResult
query1(sql: string, ...args: any): QueryResult1
query11(sql: string, ...args: any): QueryResult11
exec(sql: string, ...args: any): ExecResult
insert(table: string, data: Object): ExecResult
replace(table: string, data: Object): ExecResult
update(table: string, data: Object, where: string, ...args: any): ExecResult
delete(table: string, where: string, ...args: any): ExecResult
end(ok: boolean): void
makeInKeys(numKeys: number): string
}
interface QueryResult {
sql: string
args: Array<any>
result: Array<Object>
}
interface QueryResult1 {
sql: string
args: Array<any>
result: Object
}
interface QueryResult11 {
sql: string
args: Array<any>
result: any
}
interface ExecResult {
sql: string
args: Array<any>
id: number
changes: number
}