ai_old/js/lib/db.ts
Star e69b9a3a12 add db、log support
support embedding for llm
support watch run for js
many other updates
2024-09-29 21:20:28 +08:00

59 lines
1.5 KiB
TypeScript

// just for develop
export default {
get,
}
function get(dbName: string): DB {return null}
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
}
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
}
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
}