@tugou/sequelize
Advanced tools
@@ -9,4 +9,6 @@ export declare class BaseModel { | ||
| create(values: object, options?: object): Promise<any>; | ||
| bulkCreate(values: object, options?: object): Promise<any>; | ||
| update(values: object, options?: object): Promise<any>; | ||
| destroy(options: object): Promise<any>; | ||
| count(options: object): Promise<any>; | ||
| findAll(options: object): Promise<any>; | ||
@@ -13,0 +15,0 @@ findAndCountAll(options: any): Promise<false | { |
+23
-0
@@ -50,2 +50,14 @@ "use strict"; | ||
| } | ||
| async bulkCreate(values, options = {}) { | ||
| try { | ||
| let ret = await this.entity.bulkCreate(values, options); | ||
| console.info('[sequelize] [bulkCreate] ', JSON.stringify(ret)); | ||
| // 返回创建好的 Json | ||
| return ret; | ||
| } | ||
| catch (e) { | ||
| console.error('[sequelize] [bulkCreate] ', e); | ||
| return false; | ||
| } | ||
| } | ||
| async update(values, options = {}) { | ||
@@ -74,2 +86,13 @@ try { | ||
| } | ||
| async count(options) { | ||
| try { | ||
| const ret = await this.entity.count(options); | ||
| console.info('[sequelize] [count] ', ret); | ||
| return ret; | ||
| } | ||
| catch (e) { | ||
| console.error('[sequelize] [count] ', e); | ||
| return false; | ||
| } | ||
| } | ||
| async findAll(options) { | ||
@@ -76,0 +99,0 @@ try { |
+2
-2
| { | ||
| "name": "@tugou/sequelize", | ||
| "version": "1.0.15", | ||
| "version": "1.1.0", | ||
| "description": "midwayjs sequelize", | ||
@@ -29,3 +29,3 @@ "main": "dist/index", | ||
| "license": "MIT", | ||
| "gitHead": "17f9cc3e888e5eae579318dc255a323f6ed43b5e" | ||
| "gitHead": "eac86d7b86242f60e6d6db9bea043b7961ff947e" | ||
| } |
11421
7.6%271
10.16%