UNPKG

@varasto/query

Version:

Query and bulk operation utilities for Varasto storage

22 lines (21 loc) 1.06 kB
import { Entry, Storage } from '@varasto/storage'; import { Schema } from 'simple-json-match'; import { JsonObject } from 'type-fest'; /** * Searches for entries from given namespace that match given schema and * returns their values. If no entries match the given schema, empty array * is returned instead. */ export declare function findAll<T extends JsonObject>(storage: Storage, namespace: string, schema: Schema): AsyncGenerator<T>; /** * Searches for entries from given namespace that match given schema and * returns their keys. If no entries match the given schema, empty array is * returned instead. */ export declare function findAllKeys(storage: Storage, namespace: string, schema: Schema): AsyncGenerator<string>; /** * Searches for entries from given namespace that match given schema and * returns them in an array. If no entries match the given schema, empty * array is returned instead. */ export declare function findAllEntries<T extends JsonObject>(storage: Storage, namespace: string, schema: Schema): AsyncGenerator<Entry<T>>;