refactor: rename package

This commit is contained in:
2019-06-21 16:47:18 +08:00
parent 2f990bc41d
commit 7288d33ce2
39 changed files with 39 additions and 38 deletions

4
packages/db/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/node_modules
/dist
/package-lock.json
/yarn.lock

22
packages/db/.npmignore Normal file
View File

@@ -0,0 +1,22 @@
src
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions

11
packages/db/README.md Normal file
View File

@@ -0,0 +1,11 @@
# `cc-server-db`
> TODO: description
## Usage
```
const ccServerDb = require('cc-server-db');
// TODO: DEMONSTRATE API
```

28
packages/db/package.json Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "@cc-server/db",
"version": "0.3.0",
"description": "> TODO: description",
"author": "MiaoWoo <admin@yumc.pw>",
"homepage": "https://github.com/502647092/cc-server-parent#readme",
"license": "ISC",
"main": "dist/index.js",
"publishConfig": {
"registry": "https://repo.yumc.pw/repository/npm-hosted/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/502647092/cc-server-parent.git"
},
"scripts": {
"build": "rimraf dist && npx tsc",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
"url": "https://github.com/502647092/cc-server-parent/issues"
},
"devDependencies": {
"mocha": "^6.1.4",
"rimraf": "^2.6.3",
"typescript": "^3.5.1"
}
}

13
packages/db/src/index.ts Normal file
View File

@@ -0,0 +1,13 @@
export const DBClient = Symbol.for('DBClient')
export interface DBClient<T = any> {
getProvide<P>(): P;
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>;
}

View File

@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist"
}
}