feat: add cc-server-db
This commit is contained in:
11
packages/cc-server-db/src/index.ts
Normal file
11
packages/cc-server-db/src/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export const DBClient = Symbol.for('DBClient')
|
||||
export interface DBClient<T = any> {
|
||||
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user