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 0990ab65
authored
Aug 27, 2014
by
José Moreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sequelize.set: make options.transaction required
1 parent
45f8a7c3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
lib/sequelize.js
test/sequelize.test.js
lib/sequelize.js
View file @
0990ab6
...
...
@@ -560,9 +560,9 @@ module.exports = (function() {
* If you want to set variables for a specific query, you should create a transaction and pass it on options.
*
* @method set
* @param {Object} Object with multiple variables.
* @param {Object}
[options={}]
Query options.
* @param {Transaction}
[options.transaction=null]
The transaction that the query should be executed under
* @param {Object}
variables
Object with multiple variables.
* @param {Object}
options={}
Query options.
* @param {Transaction}
options.transaction=null
The transaction that the query should be executed under
* @return {Promise}
*
*/
...
...
@@ -572,6 +572,10 @@ module.exports = (function() {
// Prepare options
options
=
Utils
.
_
.
extend
(
{},
this
.
options
.
set
,
typeof
options
===
'object'
&&
options
||
{}
);
if
(
!
options
.
transaction
||
!
(
options
.
transaction
instanceof
Transaction
)
)
{
return
Promise
.
rejected
(
new
TypeError
(
"options.transaction is required"
)
);
}
// Override some options, since this isn't a SELECT
options
.
raw
=
true
;
options
.
plain
=
true
;
...
...
test/sequelize.test.js
View file @
0990ab6
...
...
@@ -449,7 +449,18 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
}
})
describe
(
'set'
,
function
()
{
describe
.
only
(
'set'
,
function
()
{
it
(
"should return an promised error if transaction isn't defined"
,
function
(
done
)
{
var
S
=
this
.
sequelize
;
S
.
set
({
foo
:
'bar'
})
.
done
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceof
(
TypeError
)
done
();
});
})
it
(
"one value"
,
function
(
done
)
{
var
S
=
this
.
sequelize
;
...
...
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