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 e2c17b58
authored
Nov 06, 2012
by
Jisoo Park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Local options overwite global
Replaced Utils.merge with Utils._.extend
1 parent
3eb036f5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
12 deletions
lib/associations/has-many-double-linked.js
lib/associations/has-many-single-linked.js
lib/dao-factory.js
lib/sequelize.js
lib/utils.js
spec-jasmine/sequelize.spec.js
lib/associations/has-many-double-linked.js
View file @
e2c17b5
...
...
@@ -26,7 +26,7 @@ module.exports = (function() {
options
.
where
[
self
.
__factory
.
target
.
tableName
+
"."
+
index
]
=
value
;
});
options
.
where
=
options
.
where
?
Utils
.
merge
(
options
.
where
,
where
)
:
where
options
.
where
=
options
.
where
?
Utils
.
_
.
extend
(
options
.
where
,
where
)
:
where
}
else
{
options
.
where
=
where
;
}
...
...
lib/associations/has-many-single-linked.js
View file @
e2c17b5
...
...
@@ -11,7 +11,7 @@ module.exports = (function() {
where
[
this
.
__factory
.
identifier
]
=
this
.
instance
.
id
options
.
where
=
options
.
where
?
Utils
.
merge
(
options
.
where
,
where
)
:
where
options
.
where
=
options
.
where
?
Utils
.
_
.
extend
(
options
.
where
,
where
)
:
where
return
this
.
__factory
.
target
.
findAll
(
options
)
}
...
...
lib/dao-factory.js
View file @
e2c17b5
...
...
@@ -60,7 +60,7 @@ module.exports = (function() {
}
DAOFactory
.
prototype
.
sync
=
function
(
options
)
{
options
=
Utils
.
merge
(
options
||
{},
this
.
options
)
options
=
Utils
.
_
.
extend
(
options
||
{},
this
.
options
)
var
self
=
this
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
...
...
lib/sequelize.js
View file @
e2c17b5
...
...
@@ -91,7 +91,7 @@ module.exports = (function() {
Sequelize
.
prototype
.
define
=
function
(
daoName
,
attributes
,
options
)
{
options
=
options
||
{}
if
(
this
.
options
.
define
)
{
options
=
Sequelize
.
Utils
.
merge
(
options
,
this
.
options
.
define
)
options
=
Utils
.
_
.
extend
({},
this
.
options
.
define
,
options
)
}
options
.
omitNull
=
this
.
options
.
omitNull
...
...
@@ -133,7 +133,7 @@ module.exports = (function() {
options
=
options
||
{}
if
(
this
.
options
.
sync
)
{
options
=
Sequelize
.
Utils
.
merge
(
options
,
this
.
options
.
sync
)
options
=
Utils
.
_
.
extend
({},
this
.
options
.
sync
,
options
)
}
var
chainer
=
new
Utils
.
QueryChainer
()
...
...
lib/utils.js
View file @
e2c17b5
...
...
@@ -92,13 +92,6 @@ var Utils = module.exports = {
return
Utils
.
Lingo
.
en
.
isPlural
(
s
)
?
s
:
Utils
.
Lingo
.
en
.
pluralize
(
s
)
},
merge
:
function
(
a
,
b
){
for
(
var
key
in
b
)
{
a
[
key
]
=
b
[
key
]
}
return
a
},
removeCommentsFromFunctionString
:
function
(
s
)
{
s
=
s
.
replace
(
/
\s
*
(\/\/
.*
)
/g
,
''
)
s
=
s
.
replace
(
/
(\/\*[\n\r\s\S]
*
?\*\/)
/mg
,
''
)
...
...
spec-jasmine/sequelize.spec.js
View file @
e2c17b5
...
...
@@ -40,6 +40,12 @@ describe('Sequelize', function() {
sequelize
.
define
(
'foo'
,
{
title
:
Sequelize
.
STRING
})
expect
(
sequelize
.
daoFactoryManager
.
all
.
length
).
toEqual
(
1
)
})
it
(
"overwrites global options"
,
function
()
{
setup
({
define
:
{
collate
:
'utf8_general_ci'
}
})
var
DAO
=
sequelize
.
define
(
'foo'
,
{
bar
:
Sequelize
.
STRING
},
{
collate
:
'utf8_bin'
})
expect
(
DAO
.
options
.
collate
).
toEqual
(
'utf8_bin'
)
})
})
describe
(
'sync'
,
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