@varasto/query
Version:
Query and bulk operation utilities for Varasto storage
24 lines (23 loc) • 1.3 kB
TypeScript
import { Entry, Storage } from '@varasto/storage';
import { Schema } from 'simple-json-match';
import { JsonObject } from 'type-fest';
/**
* Splits values of entries from given namespace into two arrays depending on
* whether they match the given schema. Entries that match the schema will be
* returned first element of returned array, while the remaining entries will
* be second.
*/
export declare const partition: <T extends JsonObject>(storage: Storage, namespace: string, schema: Schema) => Promise<[T[], T[]]>;
/**
* Splits keys of entries from given namespace into two arrays depending on
* whether they match the given schema. Entries that match the schema will be
* returned first element of returned array, while the remaining entries will
* be second.
*/
export declare const partitionKeys: (storage: Storage, namespace: string, schema: Schema) => Promise<[string[], string[]]>;
/**
* Splits entries from given namespace into two arrays depending on whether
* they match the given schema. Entries that match the schema will be returned
* first element of returned array, while the remaining entries will be second.
*/
export declare const partitionEntries: <T extends JsonObject>(storage: Storage, namespace: string, schema: Schema) => Promise<[Entry<T>[], Entry<T>[]]>;