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 42ab0971
authored
Dec 14, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed connector to dialect
1 parent
b551099d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
27 deletions
lib/query-interface.js
lib/sequelize.js
spec/mysql/query-generator.spec.js
spec/sqlite/model-factory.spec.js
lib/query-interface.js
View file @
42ab097
...
@@ -4,7 +4,7 @@ var Utils = require('./utils')
...
@@ -4,7 +4,7 @@ var Utils = require('./utils')
module
.
exports
=
(
function
()
{
module
.
exports
=
(
function
()
{
var
QueryInterface
=
function
(
sequelize
)
{
var
QueryInterface
=
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
this
.
sequelize
=
sequelize
this
.
QueryGenerator
=
require
(
'./
connectors/'
+
this
.
sequelize
.
options
.
connector
+
'/query-generator'
)
this
.
QueryGenerator
=
require
(
'./
dialects/'
+
this
.
sequelize
.
options
.
dialect
+
'/query-generator'
)
}
}
Utils
.
addEventEmitter
(
QueryInterface
)
Utils
.
addEventEmitter
(
QueryInterface
)
...
...
lib/sequelize.js
View file @
42ab097
...
@@ -8,7 +8,7 @@ var Utils = require("./utils")
...
@@ -8,7 +8,7 @@ var Utils = require("./utils")
module
.
exports
=
(
function
()
{
module
.
exports
=
(
function
()
{
var
Sequelize
=
function
(
database
,
username
,
password
,
options
)
{
var
Sequelize
=
function
(
database
,
username
,
password
,
options
)
{
this
.
options
=
Utils
.
_
.
extend
({
this
.
options
=
Utils
.
_
.
extend
({
connector
:
'mysql'
,
dialect
:
'mysql'
,
host
:
'localhost'
,
host
:
'localhost'
,
port
:
3306
,
port
:
3306
,
define
:
{},
define
:
{},
...
@@ -24,7 +24,7 @@ module.exports = (function() {
...
@@ -24,7 +24,7 @@ module.exports = (function() {
port
:
this
.
options
.
port
port
:
this
.
options
.
port
}
}
var
ConnectorManager
=
require
(
"./
connectors/"
+
this
.
options
.
connector
+
"/connector-manager"
)
var
ConnectorManager
=
require
(
"./
dialects/"
+
this
.
options
.
dialect
+
"/connector-manager"
)
this
.
modelManager
=
new
ModelManager
(
this
)
this
.
modelManager
=
new
ModelManager
(
this
)
this
.
connectorManager
=
new
ConnectorManager
(
this
,
this
.
config
)
this
.
connectorManager
=
new
ConnectorManager
(
this
,
this
.
config
)
...
...
spec/mysql/query-generator.spec.js
View file @
42ab097
...
@@ -2,7 +2,7 @@ var config = require("../config/config")
...
@@ -2,7 +2,7 @@ var config = require("../config/config")
,
Sequelize
=
require
(
"../../index"
)
,
Sequelize
=
require
(
"../../index"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
Helpers
=
new
(
require
(
"../config/helpers"
))(
sequelize
)
,
Helpers
=
new
(
require
(
"../config/helpers"
))(
sequelize
)
,
QueryGenerator
=
require
(
"../../lib/
connector
s/mysql/query-generator"
)
,
QueryGenerator
=
require
(
"../../lib/
dialect
s/mysql/query-generator"
)
,
util
=
require
(
"util"
)
,
util
=
require
(
"util"
)
describe
(
'QueryGenerator'
,
function
()
{
describe
(
'QueryGenerator'
,
function
()
{
...
...
spec/sqlite/model-factory.spec.js
View file @
42ab097
var
config
=
require
(
"../config/config"
)
var
config
=
require
(
"../config/config"
)
,
Sequelize
=
require
(
"../../index"
)
,
Sequelize
=
require
(
"../../index"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
true
,
connector
:
'sqlite'
})
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
,
dialect
:
'sqlite'
})
,
Helpers
=
new
(
require
(
"../config/helpers"
))(
sequelize
)
,
Helpers
=
new
(
require
(
"../config/helpers"
))(
sequelize
)
describe
(
'ModelFactory'
,
function
()
{
describe
(
'ModelFactory'
,
function
()
{
...
@@ -107,29 +107,29 @@ describe('ModelFactory', function() {
...
@@ -107,29 +107,29 @@ describe('ModelFactory', function() {
////////// min //////////////
////////// min //////////////
//
describe('.min', function() {
describe
(
'.min'
,
function
()
{
//
it("should return the min value", function() {
it
(
"should return the min value"
,
function
()
{
//
for(var i = 2; i < 5; i++) Helpers.Factories.User({ age: i })
for
(
var
i
=
2
;
i
<
5
;
i
++
)
Helpers
.
Factories
.
User
({
age
:
i
})
//
Helpers.async(function(done) {
Helpers
.
async
(
function
(
done
)
{
//
User.min('age').on('success', function(min) {
User
.
min
(
'age'
).
on
(
'success'
,
function
(
min
)
{
//
expect(min).toEqual(2); done()
expect
(
min
).
toEqual
(
2
);
done
()
//
})
})
//
})
})
//
})
})
//
})
})
////////// max //////////////
////////// max //////////////
//
//
describe('.max', function() {
describe
(
'.max'
,
function
()
{
//
it("should return the max value", function() {
it
(
"should return the max value"
,
function
()
{
//
for(var i = 2; i <= 5; i++) Helpers.Factories.User({ age: i })
for
(
var
i
=
2
;
i
<=
5
;
i
++
)
Helpers
.
Factories
.
User
({
age
:
i
})
//
//
Helpers.async(function(done) {
Helpers
.
async
(
function
(
done
)
{
//
User.max('age').on('success', function(min) {
User
.
max
(
'age'
).
on
(
'success'
,
function
(
min
)
{
//
expect(min).toEqual(5); done()
expect
(
min
).
toEqual
(
5
);
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