@varasto/query
Version:
Query and bulk operation utilities for Varasto storage
16 lines (15 loc) • 910 B
TypeScript
import { Entry, Storage } from '@varasto/storage';
import { Schema } from 'simple-json-match';
import { JsonObject } from 'type-fest';
/**
* Performs an bulk update where all entries from given namespace that match
* the given schema are partially updated with given value. Returns updated
* values or empty array if no entry matched the given schema.
*/
export declare function updateAll<T extends JsonObject>(storage: Storage, namespace: string, schema: Schema, value: Partial<T>): AsyncGenerator<T>;
/**
* Performs an bulk update where all entries from given namespace that match
* the given schema are partially updated with given value. Returns updated
* entries (key and value) or empty array if no entry matched the given schema.
*/
export declare function updateAllEntries<T extends JsonObject>(storage: Storage, namespace: string, schema: Schema, value: Partial<T>): AsyncGenerator<Entry<T>>;