cc-server-parent/packages/cc-server-db/src/index.ts

13 lines
526 B
TypeScript
Raw Normal View History

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 10:49:06 +00:00
setTable(table: string): void;
find(filter: object): Promise<T[]>;
findOne(filter: Object): Promise<T>;
findOneById(objectId: string): Promise<T>;
insertOne(model: T): Promise<T>;
updateOne(where: any, model: any): Promise<boolean>;
updateById(objectId: string, model: any): Promise<boolean>;
deleteOne(where: any): Promise<boolean>;
deleteById(objectId: string): Promise<boolean>;
2019-06-11 05:09:50 +00:00
}