Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/plugin-obsessiondb/src/query/remote-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export function createRemoteExecutor(deps: {
async query<T>(sql: string): Promise<T[]> {
const res = await client.workbench.query.execute({ serviceId, query: sql })
throwIfError(res)
return res.data as T[]
const columns = res.meta.map((c) => c.name)
return res.data.map((row) =>
Array.isArray(row)
? (Object.fromEntries(columns.map((name, i) => [name, row[i]])) as T)
: (row as T),
)
},

async insert<T extends Record<string, unknown>>(params: { table: string; values: T[] }) {
Expand Down
Loading