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 6b9a110e
authored
Aug 03, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first execution of api sugar works
1 parent
3ed27be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletions
lib/dao-factory.js
test/dao-factory.test.js
lib/dao-factory.js
View file @
6b9a110
...
...
@@ -71,6 +71,7 @@ module.exports = (function() {
var
dataset
=
this
.
dataset
()
,
result
=
dataset
[
methodName
].
apply
(
dataset
,
arguments
)
,
dialect
=
this
.
daoFactoryManager
.
sequelize
.
options
.
dialect
,
self
=
this
result
.
toSql
=
function
()
{
var
query
=
result
.
toQuery
()
...
...
@@ -78,7 +79,7 @@ module.exports = (function() {
}
result
.
exec
=
function
()
{
console
.
log
(
"would exec"
,
result
.
toSql
()
)
return
self
.
QueryInterface
.
queryAndEmit
([
result
.
toSql
(),
self
,
{
type
:
'SELECT'
}],
'snafu'
)
}
return
result
...
...
test/dao-factory.test.js
View file @
6b9a110
...
...
@@ -2701,5 +2701,31 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
expect
(
sql
).
to
.
equal
(
sqlMap
[
dialect
])
})
})
describe
(
"exec"
,
function
()
{
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
User
.
create
({
username
:
"foo"
})
.
then
(
function
()
{
return
self
.
User
.
create
({
username
:
"bar"
})
})
.
then
(
function
()
{
done
()
})
})
it
(
"selects all users with name 'foo'"
,
function
(
done
)
{
this
.
User
.
where
({
username
:
"foo"
})
.
exec
()
.
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
"foo"
)
done
()
})
})
})
})
})
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