@marianmeres/kv 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/adapter/postgres.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@ Key-value storage abstraction layer with support of multiple backend adapters:
|
|
|
5
5
|
- postgresql
|
|
6
6
|
- memory
|
|
7
7
|
|
|
8
|
+
The API is inspired by the Redis API.
|
|
9
|
+
|
|
8
10
|
TODO: Deno KV adapter
|
|
9
11
|
|
|
10
12
|
## Installation
|
|
@@ -25,8 +27,7 @@ import { createKVClient } from '@marianmeres/kv';
|
|
|
25
27
|
const client = createKVClient(
|
|
26
28
|
"my-app-namespace",
|
|
27
29
|
type: 'redis' | 'postgres' | 'memory' = 'memory',
|
|
28
|
-
|
|
29
|
-
options, // other options
|
|
30
|
+
options, // options... redisClient (for redis) or pg.Pool/pg.Client (for postgres)...
|
|
30
31
|
);
|
|
31
32
|
|
|
32
33
|
//
|
package/dist/adapter/postgres.js
CHANGED
|
@@ -26,7 +26,7 @@ export class AdapterPostgres extends AdapterAbstract {
|
|
|
26
26
|
const safe = (name) => `${name}`.replace(/\W/g, "");
|
|
27
27
|
await db.query(`
|
|
28
28
|
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
29
|
-
key VARCHAR(
|
|
29
|
+
key VARCHAR(512) PRIMARY KEY,
|
|
30
30
|
value JSONB NOT NULL,
|
|
31
31
|
expires_at TIMESTAMP WITH TIME ZONE,
|
|
32
32
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marianmeres/kv",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/mod.js",
|
|
6
6
|
"types": "dist/mod.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@marianmeres/clog": "^2.3.3",
|
|
18
18
|
"pg": "^8.16.3",
|
|
19
|
-
"redis": "^5.
|
|
19
|
+
"redis": "^5.8.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "latest",
|