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 b987a80f
authored
Jul 14, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making the code climate a bit nice
1 parent
3f510d83
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
39 deletions
lib/dialects/sqlite/query-generator.js
lib/model.js
lib/query-interface.js
lib/utils.js
lib/dialects/sqlite/query-generator.js
View file @
b987a80
lib/model.js
View file @
b987a80
...
@@ -127,7 +127,7 @@ module.exports = (function() {
...
@@ -127,7 +127,7 @@ module.exports = (function() {
// inject the node-sql methods to the dao factory in order to
// inject the node-sql methods to the dao factory in order to
// receive the syntax sugar ...
// receive the syntax sugar ...
(
function
()
{
(
function
()
{
var
instance
=
sql
.
define
({
name
:
'dummy'
,
columns
:
[]
});
var
instance
=
sql
.
define
({
name
:
'dummy'
,
columns
:
[]
});
for
(
var
methodName
in
instance
)
{
for
(
var
methodName
in
instance
)
{
...
@@ -1083,7 +1083,7 @@ module.exports = (function() {
...
@@ -1083,7 +1083,7 @@ module.exports = (function() {
options
=
Utils
.
_
.
extend
({
options
=
Utils
.
_
.
extend
({
transaction
:
null
transaction
:
null
},
options
||
{});
},
options
||
{});
if
(
!
(
where
instanceof
Utils
.
or
)
&&
!
(
where
instanceof
Utils
.
and
)
&&
!
Array
.
isArray
(
where
))
{
if
(
!
(
where
instanceof
Utils
.
or
)
&&
!
(
where
instanceof
Utils
.
and
)
&&
!
Array
.
isArray
(
where
))
{
for
(
var
attrname
in
where
)
{
for
(
var
attrname
in
where
)
{
...
...
lib/query-interface.js
View file @
b987a80
lib/utils.js
View file @
b987a80
...
@@ -339,23 +339,6 @@ var Utils = module.exports = {
...
@@ -339,23 +339,6 @@ var Utils = module.exports = {
return
''
;
return
''
;
}
}
},
},
hasChanged
:
function
(
attrValue
,
value
)
{
//If attribute value is Date, check value as a date
if
(
Utils
.
_
.
isDate
(
attrValue
)
&&
!
Utils
.
_
.
isDate
(
value
))
{
value
=
new
Date
(
value
);
}
if
(
Utils
.
_
.
isDate
(
attrValue
))
{
return
attrValue
.
valueOf
()
!==
value
.
valueOf
();
}
//If both of them are empty, don't set as changed
if
((
attrValue
===
undefined
||
attrValue
===
null
||
attrValue
===
''
)
&&
(
value
===
undefined
||
value
===
null
||
value
===
''
))
{
return
false
;
}
return
attrValue
!==
value
;
},
argsArePrimaryKeys
:
function
(
args
,
primaryKeys
)
{
argsArePrimaryKeys
:
function
(
args
,
primaryKeys
)
{
var
result
=
(
args
.
length
===
Object
.
keys
(
primaryKeys
).
length
);
var
result
=
(
args
.
length
===
Object
.
keys
(
primaryKeys
).
length
);
if
(
result
)
{
if
(
result
)
{
...
@@ -427,18 +410,6 @@ var Utils = module.exports = {
...
@@ -427,18 +410,6 @@ var Utils = module.exports = {
return
true
;
return
true
;
},
},
setAttributes
:
function
(
hash
,
identifier
,
instance
,
prefix
)
{
prefix
=
prefix
||
''
;
if
(
this
.
_
.
isPlainObject
(
identifier
))
{
this
.
_
.
each
(
identifier
,
function
(
elem
,
key
)
{
hash
[
prefix
+
key
]
=
Utils
.
_
.
isString
(
instance
)
?
instance
:
Utils
.
_
.
isObject
(
instance
)
?
instance
[
elem
.
key
||
elem
]
:
null
;
});
}
else
{
hash
[
prefix
+
identifier
]
=
Utils
.
_
.
isString
(
instance
)
?
instance
:
Utils
.
_
.
isObject
(
instance
)
?
instance
.
id
:
null
;
}
return
hash
;
},
removeNullValuesFromHash
:
function
(
hash
,
omitNull
,
options
)
{
removeNullValuesFromHash
:
function
(
hash
,
omitNull
,
options
)
{
var
result
=
hash
;
var
result
=
hash
;
...
@@ -461,14 +432,6 @@ var Utils = module.exports = {
...
@@ -461,14 +432,6 @@ var Utils = module.exports = {
return
result
;
return
result
;
},
},
firstValueOfHash
:
function
(
obj
)
{
for
(
var
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
))
return
obj
[
key
];
}
return
null
;
},
inherit
:
function
(
SubClass
,
SuperClass
)
{
inherit
:
function
(
SubClass
,
SuperClass
)
{
if
(
SuperClass
.
constructor
===
Function
)
{
if
(
SuperClass
.
constructor
===
Function
)
{
// Normal Inheritance
// Normal Inheritance
...
...
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