datastore-core
Version:
Wrapper implementation for interface-datastore
25 lines • 1.32 kB
TypeScript
import { BaseDatastore } from './base.js';
import type { KeyTransform } from './index.js';
import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore';
import type { AbortOptions, AwaitIterable } from 'interface-store';
/**
* A datastore shim, that wraps around a given datastore, changing
* the way keys look to the user, for example namespacing
* keys, reversing them, etc.
*/
export declare class KeyTransformDatastore extends BaseDatastore {
private readonly child;
transform: KeyTransform;
constructor(child: Datastore, transform: KeyTransform);
put(key: Key, val: Uint8Array, options?: AbortOptions): Promise<Key>;
get(key: Key, options?: AbortOptions): Promise<Uint8Array>;
has(key: Key, options?: AbortOptions): Promise<boolean>;
delete(key: Key, options?: AbortOptions): Promise<void>;
putMany(source: AwaitIterable<Pair>, options?: AbortOptions): AsyncIterable<Key>;
getMany(source: AwaitIterable<Key>, options?: AbortOptions): AsyncIterable<Pair>;
deleteMany(source: AwaitIterable<Key>, options?: AbortOptions): AsyncIterable<Key>;
batch(): Batch;
query(q: Query, options?: AbortOptions): AsyncIterable<Pair>;
queryKeys(q: KeyQuery, options?: AbortOptions): AsyncIterable<Key>;
}
//# sourceMappingURL=keytransform.d.ts.map