db/db.ts

87 lines
2.6 KiB
TypeScript
Raw Permalink Normal View History

2024-10-11 11:32:50 +08:00
// just for develop
export default {
get,
setDefault,
make,
query,
query1,
query11,
exec,
insert,
replace,
update,
delete: delete_,
destroy,
begin,
2024-10-27 00:36:18 +08:00
makeInKeys,
2024-10-11 11:32:50 +08:00
}
2024-10-27 00:36:18 +08:00
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 '' }
2024-10-11 11:32:50 +08:00
interface DB {
make(descFileOrContent: string): Array<Object>
2024-10-27 00:36:18 +08:00
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
2024-10-11 11:32:50 +08:00
destroy(): void
begin(): Tx
2024-10-27 00:36:18 +08:00
makeInKeys(numKeys: number): string
2024-10-11 11:32:50 +08:00
}
interface Tx {
2024-10-27 00:36:18 +08:00
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
2024-10-11 11:32:50 +08:00
}
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
}