You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Name of the table where the locks will be stored
155
132
table: {
156
-
// Name of the table where the locks will be stored
157
133
name: 'locks'
158
134
},
159
-
160
-
// Credentials to use to connect to DynamoDB
161
-
credentials: {
162
-
accessKeyId: '...',
163
-
secretAccessKey: '...'
164
-
}
165
135
})
166
136
167
137
const lockFactory =newLockFactory(store)
@@ -176,192 +146,91 @@ The DynamoDB table will be automatically created if it does not exists. Otherwis
176
146
| Option | Description | Default |
177
147
| --- | --- | --- |
178
148
|`table.name`| The name of the table that will be used to store the cache. |`cache`|
179
-
|`credentials`| The credentials to use to connect to DynamoDB. | N/A |
180
-
|`endpoint`| The endpoint to use to connect to DynamoDB. | N/A |
181
-
|`region`| The region to use to connect to DynamoDB. | N/A |
149
+
|`connection`| An instance of `DynamoDBClient`| N/A |
182
150
183
151
## Databases
184
152
185
-
We offer several drivers to use a database as the locks store. Under the hood, we use [Knex](https://knexjs.org/). So all Knex options are available, feel free to check out the documentation.
153
+
We offer several drivers to use a database as the locks store. The database store should use an adapter for your database. Out of the box, we support [Knex](https://knexjs.org/) and [Kysely](https://kysely.dev/) to interact with the database. Knex and Kysely support many databases : SQLite, MySQL, PostgreSQL, MSSQL, Oracle, and more.
154
+
155
+
:::note
186
156
187
-
All SQL drivers accept the following options:
157
+
Note that you can easily create your own adapter by implementing the `DatabaseAdapter` interface if you are using another library not supported by Verrou. See the [documentation](/docs/advanced/custom-adapters) for more details.
158
+
159
+
:::
160
+
161
+
All Database drivers accept the following common options:
188
162
189
163
| Option | Description | Default |
190
164
| --- | --- | --- |
191
165
|`tableName`| The name of the table that will be used to store the locks. |`verrou`|
192
166
|`autoCreateTable`| If the table should be automatically created if it does not exist. |`true`|
193
-
|`connection`| The connection options to use to connect to the database or an instance of `knex`. | N/A |
194
167
195
-
### PostgreSQL
168
+
### Knex
196
169
197
-
You will need to install `pg` to use this driver.
170
+
You must provide a Knex instance to use the Knex driver. Feel free to check the [Knex documentation](https://knexjs.org/) for more details about the configuration. Knex support many databases : SQLite, MySQL, PostgreSQL, MSSQL, Oracle, and more.
const db =knex({ client: 'mysql2', connection: MYSQL_CREDENTIALS })
197
+
const store =knexStore({ dialect: 'sqlite', connection: db })
326
198
const lockFactory =newLockFactory(store)
327
199
```
328
200
329
201
:::
330
202
203
+
### Kysely
331
204
332
-
### SQLite ( sqlite3 )
205
+
You must provide a Kysely instance to use the Kysely driver. Feel free to check the [Kysely documentation](https://kysely.dev/) for more details about the configuration. Kysely support the following databases : SQLite, MySQL, PostgreSQL and MSSQL.
333
206
334
-
You will need to install `sqlite3` to use this driver.
0 commit comments