UNPKG

@naturalcycles/datastore-lib

Version:

Opinionated library to work with Google Datastore, implements CommonDB

26 lines (25 loc) 1.22 kB
import type { CommonKeyValueDB, IncrementTuple, KeyValueDBTuple } from '@naturalcycles/db-lib/kv'; import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream'; import { DatastoreDB } from './datastore.db.js'; import type { DatastoreDBCfg } from './datastore.model.js'; export interface DatastoreKeyValueDBCfg extends DatastoreDBCfg { } export declare class DatastoreKeyValueDB implements CommonKeyValueDB { cfg: DatastoreKeyValueDBCfg; constructor(cfg: DatastoreKeyValueDBCfg); db: DatastoreDB; support: { increment: boolean; count?: boolean; }; ping(): Promise<void>; createTable(): Promise<void>; getByIds(table: string, ids: string[]): Promise<KeyValueDBTuple[]>; deleteByIds(table: string, ids: string[]): Promise<void>; saveBatch(table: string, entries: KeyValueDBTuple[]): Promise<void>; streamIds(table: string, limit?: number): ReadableTyped<string>; streamValues(table: string, limit?: number): ReadableTyped<Buffer>; streamEntries(table: string, limit?: number): ReadableTyped<KeyValueDBTuple>; count(table: string): Promise<number>; incrementBatch(_table: string, _entries: IncrementTuple[]): Promise<IncrementTuple[]>; }