Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pmorgan3/keyv-mssql

An MSSql adapter for keyv
https://github.com/pmorgan3/keyv-mssql

key-value keyv mssql-adapter sql-server

Last synced: 3 months ago
JSON representation

An MSSql adapter for keyv

Awesome Lists containing this project

README

        

# MSSQL storage adapter for [Keyv](https://github.com/lukechilds/keyv)

## Usage
Install keyv and keyv-mssql
```
npm install --save keyv keyv-mssql
```
Then Create a new Keyv instance, passing an instanciated KeyvMssql object as the store
```js
const Keyv = require("keyv");
const KeyvMssql = require("keyv-mssql");

const store = new KeyvMssql({
connection: {
user: "SA",
password: "Password1",
host: "localhost",
database: "TestDB"
}
});
const keyv = new Keyv({ store: store });
```

You can specify a custom table with the `table` option, the primary key size with `keySize`, and whether or not to use null as default with `useNullAsDefault`.

e.g:

```js
const store = new KeyvMssql({
connection: {
user: "SA",
password: "Password1",
host: "localhost",
database: "TestDB"
},
table: "keyv",
useNullAsDefault: true,
keySize: 255
});
```