27 lines
569 B
TypeScript
27 lines
569 B
TypeScript
declare module 'sql.js' {
|
|
export type QueryExecResult = {
|
|
columns: string[]
|
|
values: unknown[][]
|
|
}
|
|
|
|
export type Statement = {
|
|
run(values?: unknown[]): void
|
|
free(): void
|
|
}
|
|
|
|
export type Database = {
|
|
run(sql: string): void
|
|
exec(sql: string): QueryExecResult[]
|
|
prepare(sql: string): Statement
|
|
export(): Uint8Array
|
|
}
|
|
|
|
export type SqlJsStatic = {
|
|
Database: new (data?: Uint8Array | Buffer) => Database
|
|
}
|
|
|
|
export default function initSqlJs(options?: {
|
|
locateFile?: (file: string) => string
|
|
}): Promise<SqlJsStatic>
|
|
}
|