2019-06-11 05:09:50 +00:00
|
|
|
export const DBClient = Symbol.for('DBClient')
|
|
|
|
export interface DBClient<T = any> {
|
2019-06-11 08:11:34 +00:00
|
|
|
getProvide(): any;
|
2019-06-11 05:09:50 +00:00
|
|
|
find(collection: string, filter: object): Promise<T[]>;
|
|
|
|
findOne(collection: string, filter: Object): Promise<T>;
|
|
|
|
findOneById(collection: string, objectId: string): Promise<T>;
|
|
|
|
insertOne(collection: string, model: T): Promise<T>;
|
|
|
|
updateOne(collection: string, where: any, model: any): Promise<boolean>;
|
|
|
|
updateById(collection: string, objectId: string, model: any): Promise<boolean>;
|
|
|
|
deleteOne(collection: string, where: any): Promise<boolean>;
|
|
|
|
deleteById(collection: string, objectId: string): Promise<boolean>;
|
|
|
|
}
|