Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 557ff54b2b435e5f1e789c6a8a4e1bebf2d7deb6 28 lines 928 B view raw
1import type { WarehouseQueryResult, WarehouseTransactionFn } from './types.js'; 2 3/** 4 * Contract implemented by every primary warehouse adapter. 5 * 6 * Adapters power operational workloads (transactions, point queries, etc.). 7 * The interface intentionally mirrors a typical SQL client without enforcing 8 * a specific library (Kysely, Knex, pg, etc.). 9 */ 10export interface IWarehouseAdapter { 11 /** Human friendly provider name for logging / diagnostics. */ 12 readonly name: string; 13 14 /** Execute a raw SQL statement and return its rows. */ 15 query<T = WarehouseQueryResult>( 16 sql: string, 17 params?: readonly unknown[], 18 ): Promise<readonly T[]>; 19 20 /** Execute a callback inside a transaction. */ 21 transaction<T>(fn: WarehouseTransactionFn<T>): Promise<T>; 22 23 /** Flush buffers or pending work (optional for most adapters). */ 24 flush(): Promise<void>; 25 26 /** Release external resources. */ 27 close(): Promise<void>; 28}