Skip to content

Commit

Permalink
fix: adapt to db-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Oct 18, 2024
1 parent 9325445 commit ee5cd1e
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 168 deletions.
8 changes: 3 additions & 5 deletions src/betterSqliteKeyValueDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import {
CommonDBCreateOptions,
CommonKeyValueDB,
commonKeyValueDBFullSupport,
IncrementTuple,
KeyValueDBTuple,
} from '@naturalcycles/db-lib'
import { AppError, CommonLogger, StringMap } from '@naturalcycles/js-lib'
import { AppError, CommonLogger } from '@naturalcycles/js-lib'
import { boldWhite, readableCreate, ReadableTyped } from '@naturalcycles/nodejs-lib'
import type { Database, Options } from 'better-sqlite3'
import BetterSqlite3 from 'better-sqlite3'
Expand Down Expand Up @@ -207,10 +208,7 @@ export class BetterSqliteKeyValueDB implements CommonKeyValueDB {
throw new AppError('Not implemented')
}

async incrementBatch(
_table: string,
_incrementMap: StringMap<number>,
): Promise<StringMap<number>> {
async incrementBatch(_table: string, _entries: IncrementTuple[]): Promise<IncrementTuple[]> {
throw new AppError('Not implemented')
}
}
12 changes: 3 additions & 9 deletions src/sqliteKeyValueDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import {
CommonDBCreateOptions,
CommonKeyValueDB,
commonKeyValueDBFullSupport,
IncrementTuple,
KeyValueDBTuple,
} from '@naturalcycles/db-lib'
import { AppError, CommonLogger, pMap, StringMap } from '@naturalcycles/js-lib'
import { AppError, CommonLogger, pMap } from '@naturalcycles/js-lib'
import { boldWhite, readableCreate, ReadableTyped } from '@naturalcycles/nodejs-lib'
import { Database, open } from 'sqlite'
import * as sqlite3 from 'sqlite3'
Expand Down Expand Up @@ -226,14 +227,7 @@ export class SqliteKeyValueDB implements CommonKeyValueDB {
return cnt
}

async increment(_table: string, _id: string, _by?: number): Promise<number> {
throw new AppError('Not implemented')
}

async incrementBatch(
_table: string,
_incrementMap: StringMap<number>,
): Promise<StringMap<number>> {
async incrementBatch(_table: string, _entries: IncrementTuple[]): Promise<IncrementTuple[]> {
throw new AppError('Not implemented')
}
}
Loading

0 comments on commit ee5cd1e

Please sign in to comment.