You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
909 B
18 lines
909 B
import * as nedb from 'nedb'; |
|
import * as mongodb from 'mongodb'; |
|
|
|
export type dbCollection = nedb | mongodb.Collection; |
|
|
|
export interface DbQueryWrapper { |
|
dbInsertOne(collection: dbCollection, doc: object): Promise<string>; |
|
dbInsertMany(collection: dbCollection, docs: object[]): Promise<string[]>; |
|
dbUpdateOne(collection: dbCollection, query: string | object, updateQuery: object): Promise<void>; |
|
dbUpdateMany(collection: dbCollection, query: string[] | object, updateQuery: object): Promise<void>; |
|
dbFindOne(collection: dbCollection, query: string | object): Promise<any>; |
|
dbFindMany(collection: dbCollection, query: string[] | object, sortQuery: object): Promise<any[]>; |
|
dbRemoveOne(collection: dbCollection, query: string | object): Promise<boolean>; |
|
dbRemoveMany(collection: dbCollection, query: string[] | object): Promise<number>; |
|
} |
|
|
|
export class QueryExecutionError extends Error { |
|
}
|
|
|