Skip to content

Commit

Permalink
chore (docs): update the DatabaseAdapter interface (#1336)
Browse files Browse the repository at this point in the history
This PR documents the extension of the `DatabaseAdapter` interface added
in f4f020d.
  • Loading branch information
kevin-dp authored Jun 10, 2024
1 parent 2d92874 commit 2ffa6ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/integrations/drivers/other/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export interface DatabaseAdapter {
// Run an array of sql statements within a transaction.
runInTransaction(...statements: Statement[]): Promise<RunResult>

// Executes the function in isolation from any other queries/transactions executed through this adapter.
// Useful to execute queries that cannot be executed inside a transaction but still guarantee isolation from other queries.
runExclusively<T>(
f: (adapter: UncoordinatedDatabaseAdapter) => Promise<T> | T
): Promise<T>

// Run a query statement and return the results as an
// array of rows.
query(statement: Statement): Promise<Row[]>
Expand All @@ -35,7 +41,7 @@ export interface DatabaseAdapter {
}
```

For convenience, we provide two generic database adapters, `SerialDatabaseAdapter`` and `BatchDatabaseAdapter``. These implement the parts of the interface that are common to most adapters. This allows you to implement your own driver adapters using a simpler interface.
For convenience, we provide two generic database adapters, `SerialDatabaseAdapter` and `BatchDatabaseAdapter`. These implement the parts of the interface that are common to most adapters. This allows you to implement your own driver adapters using a simpler interface.
```tsx
export abstract class SerialDatabaseAdapter implements DatabaseAdapter {
// Run a single SQL statement against the DB
Expand Down

0 comments on commit 2ffa6ee

Please sign in to comment.