diff --git a/packages/storage/src/index.ts b/packages/storage/src/index.ts index 65c522e..b02361d 100644 --- a/packages/storage/src/index.ts +++ b/packages/storage/src/index.ts @@ -152,23 +152,14 @@ export class Storage { * @param opts - Options containing the SQL query, parameters, and result format preference * @returns Promise resolving to either raw query results or formatted array */ - private async query(sql: string, params?: unknown[], isRaw?: boolean) { + private async query>( + sql: string, params?: unknown[] + ) { // Now proceed with executing the query - const cursor = await this.executeRawQuery({ sql, params }) - if (!cursor) return [] - - if (isRaw) { - return { - columns: cursor.columnNames, - rows: Array.from(cursor.raw()), - meta: { - rows_read: cursor.rowsRead, - rows_written: cursor.rowsWritten, - }, - } - } + const cursor = await this.executeRawQuery({ sql, params }); + if (!cursor) return [] as T[]; - return cursor.toArray() + return cursor.toArray() as T[]; } async runMigrations() {