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 7a45d6db
authored
Jul 13, 2013
by
Daniel Durante
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned u code and where leakage/pollution should no longer occur.
1 parent
43152a2a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
13 deletions
lib/associations/has-many-double-linked.js
lib/associations/has-many-single-linked.js
lib/utils.js
spec/associations/has-many.spec.js
lib/associations/has-many-double-linked.js
View file @
7a45d6d
...
@@ -30,7 +30,7 @@ module.exports = (function() {
...
@@ -30,7 +30,7 @@ module.exports = (function() {
}
else
{
}
else
{
Utils
.
_
.
each
(
options
.
where
,
function
(
value
,
index
)
{
Utils
.
_
.
each
(
options
.
where
,
function
(
value
,
index
)
{
delete
options
.
where
[
index
];
delete
options
.
where
[
index
];
smart
=
Utils
.
smartWhere
(
value
||
[]
,
self
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
smart
=
Utils
.
smartWhere
(
value
,
self
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
smart
=
Utils
.
compileSmartWhere
.
call
(
self
.
__factory
.
target
,
smart
)
smart
=
Utils
.
compileSmartWhere
.
call
(
self
.
__factory
.
target
,
smart
)
if
(
smart
.
length
>
0
)
{
if
(
smart
.
length
>
0
)
{
value
=
smart
value
=
smart
...
@@ -39,16 +39,10 @@ module.exports = (function() {
...
@@ -39,16 +39,10 @@ module.exports = (function() {
options
.
where
[
self
.
__factory
.
target
.
tableName
+
"."
+
index
]
=
value
;
options
.
where
[
self
.
__factory
.
target
.
tableName
+
"."
+
index
]
=
value
;
});
});
Utils
.
_
.
extend
(
options
.
where
,
where
)
options
.
where
=
Utils
.
_
.
extend
(
options
.
where
,
where
)
}
}
}
else
{
}
else
{
smart
=
Utils
.
smartWhere
(
where
,
self
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
options
.
where
=
where
;
smart
=
Utils
.
compileSmartWhere
.
call
(
self
.
__factory
.
target
,
smart
,
self
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
if
(
smart
.
length
>
0
)
{
options
.
where
=
smart
}
else
{
options
.
where
=
where
;
}
}
}
self
.
__factory
.
target
.
findAllJoin
(
self
.
__factory
.
connectorDAO
.
tableName
,
options
)
self
.
__factory
.
target
.
findAllJoin
(
self
.
__factory
.
connectorDAO
.
tableName
,
options
)
...
...
lib/associations/has-many-single-linked.js
View file @
7a45d6d
...
@@ -11,14 +11,15 @@ module.exports = (function() {
...
@@ -11,14 +11,15 @@ module.exports = (function() {
options
=
options
||
{}
options
=
options
||
{}
where
[
this
.
__factory
.
identifier
]
=
this
.
instance
.
id
where
[
this
.
__factory
.
identifier
]
=
this
.
instance
.
id
options
.
where
=
options
.
where
?
Utils
.
_
.
extend
(
options
.
where
,
where
)
:
where
if
(
options
.
where
)
{
if
(
options
.
where
)
{
smart
=
Utils
.
smartWhere
(
options
.
where
||
[
],
this
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
smart
=
Utils
.
smartWhere
(
[
where
,
options
.
where
],
this
.
__factory
.
target
.
daoFactoryManager
.
sequelize
.
options
.
dialect
)
smart
=
Utils
.
compileSmartWhere
.
call
(
this
.
__factory
.
target
,
smart
)
smart
=
Utils
.
compileSmartWhere
.
call
(
this
.
__factory
.
target
,
smart
)
if
(
smart
.
length
>
0
)
{
if
(
smart
.
length
>
0
)
{
options
.
where
=
smart
options
.
where
=
smart
}
}
}
else
{
options
.
where
=
where
}
}
return
this
.
__factory
.
target
.
all
(
options
)
return
this
.
__factory
.
target
.
all
(
options
)
...
...
lib/utils.js
View file @
7a45d6d
...
@@ -118,7 +118,6 @@ var Utils = module.exports = {
...
@@ -118,7 +118,6 @@ var Utils = module.exports = {
_where
[
i
].
joined
[
_where
[
i
].
joined
.
length
]
=
where
[
i
][
ii
]
_where
[
i
].
joined
[
_where
[
i
].
joined
.
length
]
=
where
[
i
][
ii
]
break
break
default
:
default
:
console
.
log
(
'LOG'
,
logic
)
_where
[
i
].
lazy
=
_where
[
i
].
lazy
||
{
conditions
:
[],
bindings
:
[]}
_where
[
i
].
lazy
=
_where
[
i
].
lazy
||
{
conditions
:
[],
bindings
:
[]}
_where
[
i
].
lazy
.
conditions
[
_where
[
i
].
lazy
.
conditions
.
length
]
=
logic
+
' ?'
_where
[
i
].
lazy
.
conditions
[
_where
[
i
].
lazy
.
conditions
.
length
]
=
logic
+
' ?'
_where
[
i
].
lazy
.
bindings
=
_where
[
i
].
lazy
.
bindings
.
concat
(
where
[
i
][
ii
])
_where
[
i
].
lazy
.
bindings
=
_where
[
i
].
lazy
.
bindings
.
concat
(
where
[
i
][
ii
])
...
...
spec/associations/has-many.spec.js
View file @
7a45d6d
...
@@ -230,7 +230,7 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
...
@@ -230,7 +230,7 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
chainer
.
run
().
success
(
function
(
results
,
article
,
label1
,
label2
)
{
chainer
.
run
().
success
(
function
(
results
,
article
,
label1
,
label2
)
{
article
.
setLabels
([
label1
,
label2
]).
success
(
function
()
{
article
.
setLabels
([
label1
,
label2
]).
success
(
function
()
{
article
.
getLabels
({
where
:
[
'until > ?'
,
moment
(
'2014-01-0
1
'
).
toDate
()]}).
success
(
function
(
labels
)
{
article
.
getLabels
({
where
:
[
'until > ?'
,
moment
(
'2014-01-0
2
'
).
toDate
()]}).
success
(
function
(
labels
)
{
expect
(
labels
).
toBeArray
()
expect
(
labels
).
toBeArray
()
expect
(
labels
.
length
).
toEqual
(
1
)
expect
(
labels
.
length
).
toEqual
(
1
)
expect
(
labels
[
0
].
text
).
toEqual
(
'Epicness'
)
expect
(
labels
[
0
].
text
).
toEqual
(
'Epicness'
)
...
...
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