SqliteWorker: return query result instead of rows for query

This commit is contained in:
Alex Gleason
2023-11-15 19:23:24 -06:00
parent e601c43197
commit ae56d059b1
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
interface QueryResult {
rows: unknown[];
numAffectedRows: bigint;
insertId: bigint;
}
class SqliteWorker {
#path: string;
#worker: Worker;
@@ -23,7 +29,7 @@ class SqliteWorker {
return this.#call(['open', [this.#path]]);
}
async query(sql: string, params?: any): Promise<unknown[]> {
async query(sql: string, params?: any): Promise<QueryResult> {
await this.ready;
return this.#call(['query', [sql, params]]);
}