deepbase-redis 1.0.10 → 1.0.16
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 +5 -5
- package/index.mjs +3 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ console.log(configLang); // "en"
|
|
|
31
31
|
```js
|
|
32
32
|
const path = await mem.add("user", { name: "martin" });
|
|
33
33
|
|
|
34
|
-
// add() will create a secure key (ie. "
|
|
35
|
-
console.log(path) // [ 'user', '
|
|
34
|
+
// add() will create a secure key (ie. "CqtOILTDUg")
|
|
35
|
+
console.log(path) // [ 'user', 'CqtOILTDUg' ]
|
|
36
36
|
|
|
37
37
|
const userName = await mem.get(...path, "name");
|
|
38
38
|
console.log(userName); // "martin"
|
|
@@ -58,14 +58,14 @@ const lang = await mem.get("config", "lang"); // EN
|
|
|
58
58
|
await mem.add("user", { name: "anya" });
|
|
59
59
|
|
|
60
60
|
const userIds = await mem.keys("user")
|
|
61
|
-
console.log(userIds) // [ '
|
|
61
|
+
console.log(userIds) // [ 'CqtOILTDUg', 'MXOlTBSmEf' ]
|
|
62
62
|
|
|
63
63
|
console.log(await mem.get())
|
|
64
64
|
// {
|
|
65
65
|
// config: { lang: 'EN' },
|
|
66
66
|
// user: {
|
|
67
|
-
//
|
|
68
|
-
//
|
|
67
|
+
// CqtOILTDUg: { name: 'martin', balance: 580 },
|
|
68
|
+
// MXOlTBSmEf: { name: 'anya' }
|
|
69
69
|
// }
|
|
70
70
|
// }
|
|
71
71
|
```
|
package/index.mjs
CHANGED
|
@@ -8,10 +8,9 @@ export default class DeepBaseRedis {
|
|
|
8
8
|
this.nidLength = 10;
|
|
9
9
|
this.name = "db";
|
|
10
10
|
this.url = "redis://localhost:6379";
|
|
11
|
-
Object.assign(this, opts)
|
|
12
|
-
|
|
13
|
-
this.nanoid = customAlphabet(this.nidAlphabet, this.nidLength)
|
|
14
11
|
this.client = createClient({ url: this.url });
|
|
12
|
+
this.nanoid = customAlphabet(this.nidAlphabet, this.nidLength)
|
|
13
|
+
Object.assign(this, opts)
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
async disconnect() {
|
|
@@ -116,20 +115,4 @@ export default class DeepBaseRedis {
|
|
|
116
115
|
await this.set(...[...keys, id, value])
|
|
117
116
|
return [...keys, id]
|
|
118
117
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// const mem = new DeepBaseRedis();
|
|
122
|
-
|
|
123
|
-
// await mem.del('a')
|
|
124
|
-
|
|
125
|
-
// await mem.add('a', 'b', 'c', 1)
|
|
126
|
-
// await mem.add('a', 'b', 'c', 1)
|
|
127
|
-
// await mem.get('a', 'b', 'c')
|
|
128
|
-
|
|
129
|
-
// await mem.set('a', 'b', 'a', 1)
|
|
130
|
-
// await mem.set('a', 'c', 'a', 1)
|
|
131
|
-
// await mem.del('a', 'c', 'a', 1)
|
|
132
|
-
|
|
133
|
-
// console.log(await mem.get('a'))
|
|
134
|
-
|
|
135
|
-
// await client.quit();
|
|
118
|
+
}
|