Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 421fc4f1
authored
Apr 21, 2013
by
Martin Aspeli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DAO factory API sketch
1 parent
7affa31c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
lib/dao-factory.js
lib/dao-factory.js
View file @
421fc4f
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment