Skip to content

Commit

Permalink
feat(deps): adapt to db-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Oct 12, 2024
1 parent 986917e commit 8204d13
Show file tree
Hide file tree
Showing 3 changed files with 421 additions and 418 deletions.
3 changes: 2 additions & 1 deletion src/datastore.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const methodMap: Record<CommonDBSaveMethod, string> = {
export class DatastoreDB extends BaseCommonDB implements CommonDB {
override support: CommonDBSupport = {
...commonDBFullSupport,
updateByQuery: false,
patchByQuery: false,
increment: false,
}

constructor(cfg: DatastoreDBCfg = {}) {
Expand Down
21 changes: 19 additions & 2 deletions src/datastoreKeyValueDB.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { CommonKeyValueDB, DBQuery, KeyValueDBTuple } from '@naturalcycles/db-lib'
import { AppError } from '@naturalcycles/js-lib'
import {
CommonKeyValueDB,
commonKeyValueDBFullSupport,
DBQuery,
KeyValueDBTuple,
} from '@naturalcycles/db-lib'
import { AppError, StringMap } from '@naturalcycles/js-lib'
import { ReadableTyped } from '@naturalcycles/nodejs-lib'
import { DatastoreDB } from './datastore.db'
import { DatastoreDBCfg } from './datastore.model'
Expand All @@ -20,6 +25,11 @@ export class DatastoreKeyValueDB implements CommonKeyValueDB {

db: DatastoreDB

support = {
...commonKeyValueDBFullSupport,
increment: false,
}

async ping(): Promise<void> {
await this.db.ping()
}
Expand Down Expand Up @@ -88,4 +98,11 @@ export class DatastoreKeyValueDB implements CommonKeyValueDB {
async increment(_table: string, _id: string, _by?: number): Promise<number> {
throw new AppError('DatastoreKeyValueDB.increment() is not implemented')
}

async incrementBatch(
_table: string,
_incrementMap: StringMap<number>,
): Promise<StringMap<number>> {
throw new AppError('DatastoreKeyValueDB.incrementBatch() is not implemented')
}
}
Loading

0 comments on commit 8204d13

Please sign in to comment.