aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/util')
-rw-r--r--packages/taler-wallet-core/src/util/query.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts
index 17b9b407c..59c6ea2f5 100644
--- a/packages/taler-wallet-core/src/util/query.ts
+++ b/packages/taler-wallet-core/src/util/query.ts
@@ -344,6 +344,7 @@ interface IndexReadOnlyAccessor<RecordType> {
query?: IDBKeyRange | IDBValidKey,
count?: number,
): Promise<RecordType[]>;
+ count(query?: IDBValidKey): Promise<number>;
}
type GetIndexReadOnlyAccess<RecordType, IndexMap> = {
@@ -357,6 +358,7 @@ interface IndexReadWriteAccessor<RecordType> {
query?: IDBKeyRange | IDBValidKey,
count?: number,
): Promise<RecordType[]>;
+ count(query?: IDBValidKey): Promise<number>;
}
type GetIndexReadWriteAccess<RecordType, IndexMap> = {
@@ -696,6 +698,10 @@ function makeReadContext(
.getAll(query, count);
return requestToPromise(req);
},
+ count(query) {
+ const req = tx.objectStore(storeName).index(indexName).count(query);
+ return requestToPromise(req);
+ },
};
}
ctx[storeAlias] = {
@@ -745,6 +751,10 @@ function makeWriteContext(
.getAll(query, count);
return requestToPromise(req);
},
+ count(query) {
+ const req = tx.objectStore(storeName).index(indexName).count(query);
+ return requestToPromise(req);
+ },
};
}
ctx[storeAlias] = {