docs: swap Bun and Node.js SQLite sections

This commit is contained in:
dswbx
2025-09-20 10:21:08 +02:00
parent 36e61cab3f
commit 8742938074

View File

@@ -106,6 +106,23 @@ export default {
} satisfies BkndConfig; } satisfies BkndConfig;
``` ```
### Node.js SQLite
To use the Node.js SQLite adapter directly, use the `nodeSqlite` function as value for the `connection` property. This lets you customize the database connection, such as enabling WAL mode.
```typescript title="bknd.config.ts"
import { nodeSqlite, type NodeBkndConfig } from "bknd/adapter/node";
export default {
connection: nodeSqlite({
url: "file:<path/to/your/database.db>",
onCreateConnection: (db) => {
db.exec("PRAGMA journal_mode = WAL;");
},
}),
} satisfies NodeBkndConfig;
```
### Bun SQLite ### Bun SQLite
You can explicitly use the Bun SQLite adapter by passing the `bunSqlite` function to the `connection` property. This allows further configuration of the database, e.g. enabling WAL mode. You can explicitly use the Bun SQLite adapter by passing the `bunSqlite` function to the `connection` property. This allows further configuration of the database, e.g. enabling WAL mode.
@@ -123,23 +140,6 @@ export default {
} satisfies BunBkndConfig; } satisfies BunBkndConfig;
``` ```
### Node.js SQLite
To use the Node.js SQLite adapter directly, set the `connection` property to the result of the `nodeSqlite` function. This lets you customize the database connection, such as enabling WAL mode.
```typescript title="bknd.config.ts"
import { nodeSqlite, type NodeBkndConfig } from "bknd/adapter/node";
export default {
connection: nodeSqlite({
url: "file:<path/to/your/database.db>",
onCreateConnection: (db) => {
db.exec("PRAGMA journal_mode = WAL;");
},
}),
} satisfies NodeBkndConfig;
```
### LibSQL ### LibSQL
Turso offers a SQLite-fork called LibSQL that runs a server around your SQLite database. The edge-version of the adapter is included in the bundle (remote only): Turso offers a SQLite-fork called LibSQL that runs a server around your SQLite database. The edge-version of the adapter is included in the bundle (remote only):