mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
add sqlocal connection including example
This commit is contained in:
29
packages/sqlocal/README.md
Normal file
29
packages/sqlocal/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# SQLocal adapter for `bknd` (experimental)
|
||||
This packages adds an adapter to use a SQLocal database with `bknd`. It is based on [`sqlocal`](https://github.com/DallasHoff/sqlocal) and the driver included for `kysely`.
|
||||
|
||||
## Installation
|
||||
Install the adapter with:
|
||||
```bash
|
||||
npm install @bknd/sqlocal
|
||||
```
|
||||
|
||||
## Usage
|
||||
Create a connection:
|
||||
|
||||
```ts
|
||||
import { SQLocalConnection } from "@bknd/sqlocal";
|
||||
|
||||
const connection = new SQLocalConnection({
|
||||
databasePath: "db.sqlite"
|
||||
});
|
||||
```
|
||||
|
||||
Use the connection depending on which framework or runtime you are using. E.g., when using `createApp`, you can use the connection as follows:
|
||||
|
||||
```ts
|
||||
import { createApp } from "bknd";
|
||||
import { SQLocalConnection } from "@bknd/sqlocal";
|
||||
|
||||
const connection = new SQLocalConnection();
|
||||
const app = createApp({ connection });
|
||||
```
|
||||
Reference in New Issue
Block a user