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 85ab07cb
authored
May 11, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bit of style changes
1 parent
4d52706a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
lib/associations/belongs-to.js
lib/associations/has-many.js
lib/associations/belongs-to.js
View file @
85ab07c
...
@@ -88,15 +88,9 @@ module.exports = (function() {
...
@@ -88,15 +88,9 @@ module.exports = (function() {
var
association
=
this
var
association
=
this
instancePrototype
[
this
.
accessors
.
set
]
=
function
(
associatedInstance
,
options
)
{
instancePrototype
[
this
.
accessors
.
set
]
=
function
(
associatedInstance
,
options
)
{
var
value
var
value
=
associatedInstance
if
(
associatedInstance
)
{
if
(
associatedInstance
instanceof
association
.
target
.
Instance
)
{
if
(
associatedInstance
instanceof
association
.
target
.
Instance
)
{
value
=
associatedInstance
[
association
.
targetIdentifier
]
value
=
associatedInstance
[
association
.
targetIdentifier
]
}
else
{
value
=
associatedInstance
}
}
else
{
value
=
null
}
}
this
.
set
(
association
.
identifier
,
value
)
this
.
set
(
association
.
identifier
,
value
)
...
...
lib/associations/has-many.js
View file @
85ab07c
...
@@ -265,18 +265,18 @@ module.exports = (function() {
...
@@ -265,18 +265,18 @@ module.exports = (function() {
return
new
Class
(
association
,
this
).
injectGetter
(
options
,
queryOptions
)
return
new
Class
(
association
,
this
).
injectGetter
(
options
,
queryOptions
)
}
}
obj
[
this
.
accessors
.
hasAll
]
=
function
(
object
s
,
options
)
{
obj
[
this
.
accessors
.
hasAll
]
=
function
(
instance
s
,
options
)
{
var
instance
=
this
var
instance
=
this
,
where
,
where
options
=
options
||
{}
options
=
options
||
{}
objects
.
forEach
(
function
(
o
)
{
instances
.
forEach
(
function
(
instance
)
{
if
(
o
instanceof
association
.
target
.
Instance
)
{
if
(
instance
instanceof
association
.
target
.
Instance
)
{
where
=
new
Utils
.
or
([
where
,
o
.
primaryKeyValues
])
where
=
new
Utils
.
or
([
where
,
instance
.
primaryKeyValues
])
}
else
{
}
else
{
var
_where
=
{}
var
_where
=
{}
_where
[
association
.
target
.
primaryKeyAttribute
]
=
o
_where
[
association
.
target
.
primaryKeyAttribute
]
=
instance
where
=
new
Utils
.
or
([
where
,
_where
])
where
=
new
Utils
.
or
([
where
,
_where
])
}
}
})
})
...
@@ -290,21 +290,21 @@ module.exports = (function() {
...
@@ -290,21 +290,21 @@ module.exports = (function() {
options
,
options
,
{
raw
:
true
}
{
raw
:
true
}
).
then
(
function
(
associatedObjects
)
{
).
then
(
function
(
associatedObjects
)
{
return
associatedObjects
.
length
===
object
s
.
length
return
associatedObjects
.
length
===
instance
s
.
length
})
})
}
}
obj
[
this
.
accessors
.
hasSingle
]
=
function
(
o
,
options
)
{
obj
[
this
.
accessors
.
hasSingle
]
=
function
(
param
,
options
)
{
var
instance
=
this
var
instance
=
this
,
where
,
where
options
=
options
||
{}
options
=
options
||
{}
if
(
o
instanceof
association
.
target
.
Instance
)
{
if
(
param
instanceof
association
.
target
.
Instance
)
{
where
=
o
.
primaryKeyValues
where
=
param
.
primaryKeyValues
}
else
{
}
else
{
where
=
{}
where
=
{}
where
[
association
.
target
.
primaryKeyAttribute
]
=
o
where
[
association
.
target
.
primaryKeyAttribute
]
=
param
}
}
options
.
where
=
new
Utils
.
and
([
options
.
where
=
new
Utils
.
and
([
...
...
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