不要怂,就是干,撸起袖子干!

Commit 421fc4f1 by Martin Aspeli

DAO factory API sketch

1 parent 7affa31c
Showing with 37 additions and 0 deletions
......@@ -328,6 +328,43 @@ module.exports = (function() {
}).run()
}
/**
* Create and insert multiple instances
*
* @param {Array} values List of objects (key/value pairs) to create instances from
* @return {Object} A promise which fires `success`, `error`, `complete` and `sql`.
*
* The `success` handler is passed a list of newly inserted models.
*/
DaoFactory.prototype.bulkCreate = function(values, options) {
var factory = this
return this.bulkInsert(values.map(function(attrs) {
return factory.build(attrs, options)
})
}
/**
* Insert multiple instances
*
* @param {Array} daos List of built DAOs
* @return {Object} A promise which fires `success`, `error`, `complete` and `sql`.
*
* The `success` handler is passed a list of newly inserted models.
*/
DaoFactory.prototype.bulkInsert = function(daos, fields) {
// XXX: TODO
}
/**
* Delete multiple instances
*
* @param {Object} options Options to describe the scope of the search.
* @return {Object} A promise which fires `success`, `error`, `complete` and `sql`.
*/
DaoFactory.prototype.bulkDelete = function(options) {
// XXX: TODO
}
// private
var query = function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!