Skip to content

Commit

Permalink
增加批量添加的helper,自此原有open-rest 全部helper均已迁移完毕
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoxiongfei committed Oct 3, 2016
1 parent 9b9ae33 commit df3aa9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions README.md
Expand Up @@ -185,6 +185,29 @@ restHelper
.exec();
```

## restHelper.batchAdd
批量创建资源方法

```js
// Model 必选, Sequlize 定义的Model,表明数据的原型
// cols 可选, 允许设置的字段
// hook 可选, 生成实例的存放位置
// attachs 可选,要附加输出的数据格式为 key => value, value 是 req 上的路径字符串

restHelper.batchAdd(Model, cols, hook, attachs);

// return
// function(req, res, next) { ... };

//or 链式调用
restHelper
.batchAdd
.Model(User)
.cols(['name', 'age', 'gender'])
.hook('user')
.exec();
```

## restHelper.statistics
标准的资源统计功能方法

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "open-rest-helper-rest",
"version": "0.5.0",
"version": "0.6.0",
"description": "open-rest 的 helper 插件,用来实现 CRUD 的标准操作",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit df3aa9f

Please sign in to comment.