| 4 | import { transformOuterbaseResult } from "./utils"; |
| 5 | |
| 6 | export class OuterbaseQueryable implements QueryableBaseDriver { |
| 7 | protected workspaceId: string; |
| 8 | protected sourceId: string; |
| 9 | |
| 10 | constructor({ workspaceId, sourceId }: OuterbaseDatabaseConfig) { |
| 11 | this.workspaceId = workspaceId; |
| 12 | this.sourceId = sourceId; |
| 13 | } |
| 14 | |
| 15 | async query(stmt: string): Promise<DatabaseResultSet> { |
| 16 | const jsonResponse = await runOuterbaseQueryRaw( |
| 17 | this.workspaceId, |
| 18 | this.sourceId, |
| 19 | stmt |
| 20 | ); |
| 21 | |
| 22 | return transformOuterbaseResult(jsonResponse); |
| 23 | } |
| 24 | |
| 25 | async batch(stmts: string[]): Promise<DatabaseResultSet[]> { |
| 26 | return ( |
| 27 | await runOuterbaseQueryBatch(this.workspaceId, this.sourceId, stmts) |
| 28 | ).map(transformOuterbaseResult); |
| 29 | } |
| 30 | |
| 31 | async transaction(stmts: string[]): Promise<DatabaseResultSet[]> { |
| 32 | return this.batch(stmts); |
| 33 | } |
| 34 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…