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 d0d86f6b
authored
Oct 28, 2011
by
Laurent Zuijdwijk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added an example for min max functions
1 parent
b933c8bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
examples/MinMax/app.js
examples/MinMax/app.js
0 → 100644
View file @
d0d86f6
var
Sequelize
=
require
(
__dirname
+
"/../../index"
)
,
config
=
require
(
__dirname
+
"/../../test/config"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
var
Person
=
sequelize
.
define
(
'Person'
,
{
name
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
})
,
chainer
=
new
Sequelize
.
Utils
.
QueryChainer
sequelize
.
sync
({
force
:
true
}).
on
(
'success'
,
function
()
{
var
count
=
10
,
queries
=
[]
for
(
var
i
=
0
;
i
<
count
;
i
++
)
chainer
.
add
(
Person
.
create
({
name
:
'someone'
+
(
i
%
3
),
age
:
i
+
5
}))
console
.
log
(
"Begin to save "
+
count
+
" items!"
)
chainer
.
run
().
on
(
'success'
,
function
()
{
console
.
log
(
"finished"
)
Person
.
max
(
'age'
).
on
(
'success'
,
function
(
max
)
{
console
.
log
(
"Oldest person: "
+
max
)
});
Person
.
min
(
'age'
).
on
(
'success'
,
function
(
min
)
{
console
.
log
(
"Youngest person: "
+
min
)
});
})
})
\ No newline at end of file
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