db/db.ts

106 lines
3.1 KiB
TypeScript
Raw Normal View History

2024-10-11 11:32:50 +08:00
// just for develop
export default {
get,
setDefault,
make,
2024-11-22 16:36:11 +08:00
makeER,
2024-10-11 11:32:50 +08:00
query,
query1,
2025-01-14 14:28:26 +08:00
query1a,
2024-10-11 11:32:50 +08:00
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): Object[] { return null as any }
2024-11-22 16:36:11 +08:00
function makeER(outputFile: string, descFileOrContent: string): void { }
2024-10-27 00:36:18 +08:00
function query(sql: string, ...args: any): QueryResult { return null as any }
2025-01-14 14:28:26 +08:00
function querya(sql: string, ...args: any): QueryResultA { return null as any }
2024-10-27 00:36:18 +08:00
function query1(sql: string, ...args: any): QueryResult1 { return null as any }
2025-01-14 14:28:26 +08:00
function query1a(sql: string, ...args: any): QueryResult1A { return null as any }
2024-10-27 00:36:18 +08:00
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): Object[]
2024-10-27 00:36:18 +08:00
query(sql: string, ...args: any): QueryResult
query1(sql: string, ...args: any): QueryResult1
2025-01-14 14:28:26 +08:00
query1a(sql: string, ...args: any): QueryResult1A
2024-10-27 00:36:18 +08:00
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
query1a(sql: string, ...args: any): QueryResult1A
2024-10-27 00:36:18 +08:00
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: any[]
result: Object[]
2024-10-11 11:32:50 +08:00
}
2025-01-14 14:28:26 +08:00
interface QueryResultA {
sql: string
args: any[]
result: any[][]
}
2024-10-11 11:32:50 +08:00
interface QueryResult1 {
sql: string
args: any[]
2024-10-11 11:32:50 +08:00
result: Object
}
interface QueryResult1A {
sql: string
args: any[]
result: any[]
}
2024-10-11 11:32:50 +08:00
interface QueryResult11 {
sql: string
args: any[]
2024-10-11 11:32:50 +08:00
result: any
}
interface ExecResult {
sql: string
args: any[]
2024-10-11 11:32:50 +08:00
id: number
changes: number
}