@naturalcycles/db-lib 9.10.1 → 9.11.0
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.
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { UnixTimestampNumber } from '@naturalcycles/js-lib';
|
|
2
3
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib';
|
|
3
4
|
import { CommonDBCreateOptions } from '../db.model';
|
|
4
5
|
export type KeyValueDBTuple = [key: string, value: Buffer];
|
|
6
|
+
export interface CommonKeyValueDBSaveBatchOptions {
|
|
7
|
+
/**
|
|
8
|
+
* If set (and if it's implemented by the driver) - will set expiry TTL for each key of the batch.
|
|
9
|
+
* E.g EXAT in Redis.
|
|
10
|
+
*/
|
|
11
|
+
expireAt?: UnixTimestampNumber;
|
|
12
|
+
}
|
|
5
13
|
/**
|
|
6
14
|
* Common interface for Key-Value database implementations.
|
|
7
15
|
*
|
|
@@ -24,7 +32,7 @@ export interface CommonKeyValueDB {
|
|
|
24
32
|
*/
|
|
25
33
|
getByIds: (table: string, ids: string[]) => Promise<KeyValueDBTuple[]>;
|
|
26
34
|
deleteByIds: (table: string, ids: string[]) => Promise<void>;
|
|
27
|
-
saveBatch: (table: string, entries: KeyValueDBTuple[]) => Promise<void>;
|
|
35
|
+
saveBatch: (table: string, entries: KeyValueDBTuple[], opt?: CommonKeyValueDBSaveBatchOptions) => Promise<void>;
|
|
28
36
|
streamIds: (table: string, limit?: number) => ReadableTyped<string>;
|
|
29
37
|
streamValues: (table: string, limit?: number) => ReadableTyped<Buffer>;
|
|
30
38
|
streamEntries: (table: string, limit?: number) => ReadableTyped<KeyValueDBTuple>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { UnixTimestampNumber } from '@naturalcycles/js-lib'
|
|
1
2
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
2
3
|
import { CommonDBCreateOptions } from '../db.model'
|
|
3
4
|
|
|
4
5
|
export type KeyValueDBTuple = [key: string, value: Buffer]
|
|
5
6
|
|
|
7
|
+
export interface CommonKeyValueDBSaveBatchOptions {
|
|
8
|
+
/**
|
|
9
|
+
* If set (and if it's implemented by the driver) - will set expiry TTL for each key of the batch.
|
|
10
|
+
* E.g EXAT in Redis.
|
|
11
|
+
*/
|
|
12
|
+
expireAt?: UnixTimestampNumber
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
16
|
* Common interface for Key-Value database implementations.
|
|
8
17
|
*
|
|
@@ -29,7 +38,11 @@ export interface CommonKeyValueDB {
|
|
|
29
38
|
|
|
30
39
|
deleteByIds: (table: string, ids: string[]) => Promise<void>
|
|
31
40
|
|
|
32
|
-
saveBatch: (
|
|
41
|
+
saveBatch: (
|
|
42
|
+
table: string,
|
|
43
|
+
entries: KeyValueDBTuple[],
|
|
44
|
+
opt?: CommonKeyValueDBSaveBatchOptions,
|
|
45
|
+
) => Promise<void>
|
|
33
46
|
|
|
34
47
|
streamIds: (table: string, limit?: number) => ReadableTyped<string>
|
|
35
48
|
streamValues: (table: string, limit?: number) => ReadableTyped<Buffer>
|