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

13 lines
527 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-12 10:58:46 +00:00
getProvide<P>(): P;
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
}