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 0749e113
authored
Jul 21, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed private query method + expose public query method that returns a node-sql instance
1 parent
81d5d2a0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
lib/dao-factory.js
lib/dao-factory.js
View file @
0749e11
...
@@ -2,6 +2,7 @@ var Utils = require("./utils")
...
@@ -2,6 +2,7 @@ var Utils = require("./utils")
,
DAO
=
require
(
"./dao"
)
,
DAO
=
require
(
"./dao"
)
,
DataTypes
=
require
(
"./data-types"
)
,
DataTypes
=
require
(
"./data-types"
)
,
Util
=
require
(
'util'
)
,
Util
=
require
(
'util'
)
,
Sql
=
require
(
"sql"
)
module
.
exports
=
(
function
()
{
module
.
exports
=
(
function
()
{
var
DAOFactory
=
function
(
name
,
attributes
,
options
)
{
var
DAOFactory
=
function
(
name
,
attributes
,
options
)
{
...
@@ -519,24 +520,19 @@ module.exports = (function() {
...
@@ -519,24 +520,19 @@ module.exports = (function() {
return
this
.
QueryInterface
.
describeTable
(
this
.
tableName
)
return
this
.
QueryInterface
.
describeTable
(
this
.
tableName
)
}
}
// private
DAOFactory
.
prototype
.
query
=
function
()
{
var
dialect
=
this
.
daoFactoryManager
.
sequelize
.
options
.
dialect
var
query
=
function
()
{
,
instance
=
new
Sql
(
dialect
).
define
({
name
:
this
.
tableName
,
model
:
this
})
var
args
=
Utils
.
_
.
map
(
arguments
,
function
(
arg
,
_
)
{
return
arg
})
,
attributes
=
this
.
attributes
,
sequelize
=
this
.
daoFactoryManager
.
sequelize
// add this as the second argument
Object
.
keys
(
attributes
).
forEach
(
function
(
key
)
{
if
(
arguments
.
length
===
1
)
{
instance
.
addColumn
(
key
,
attributes
[
key
])
args
.
push
(
this
)
})
}
// add {} as options
return
instance
if
(
args
.
length
===
2
)
{
args
.
push
({})
}
}
return
sequelize
.
query
.
apply
(
sequelize
,
args
)
// private
}
var
addOptionalClassMethods
=
function
()
{
var
addOptionalClassMethods
=
function
()
{
var
self
=
this
var
self
=
this
...
...
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