不要怂,就是干,撸起袖子干!

Commit 42ab0971 by sdepold

renamed connector to dialect

1 parent b551099d
...@@ -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)
......
...@@ -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)
......
...@@ -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/connectors/mysql/query-generator") , QueryGenerator = require("../../lib/dialects/mysql/query-generator")
, util = require("util") , util = require("util")
describe('QueryGenerator', function() { describe('QueryGenerator', function() {
......
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()
// }) })
// }) })
// }) })
// }) })
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!