Run callbacks on schema ready
This commit is contained in:
parent
b5985e445d
commit
9f9aa7cd3f
|
@ -1,5 +1,6 @@
|
|||
exports.initialize = function initializeSchema(schema, callback) {
|
||||
schema.adapter = new Memory();
|
||||
callback();
|
||||
};
|
||||
|
||||
function Memory() {
|
||||
|
|
|
@ -6,6 +6,7 @@ var mongoose = require('mongoose');
|
|||
exports.initialize = function initializeSchema(schema, callback) {
|
||||
schema.client = mongoose.connect(schema.settings.url);
|
||||
schema.adapter = new MongooseAdapter(schema.client);
|
||||
callback();
|
||||
};
|
||||
|
||||
function MongooseAdapter(client) {
|
||||
|
|
|
@ -15,6 +15,7 @@ exports.initialize = function initializeSchema(schema, callback) {
|
|||
});
|
||||
|
||||
schema.adapter = new MySQL(schema.client);
|
||||
callback();
|
||||
};
|
||||
|
||||
function MySQL(client) {
|
||||
|
|
|
@ -6,6 +6,7 @@ var neo4j = require('./neo4j-lib');
|
|||
exports.initialize = function initializeSchema(schema, callback) {
|
||||
schema.client = new neo4j.GraphDatabase(schema.settings.url);
|
||||
schema.adapter = new Neo4j(schema.client);
|
||||
callback();
|
||||
};
|
||||
|
||||
function Neo4j(client) {
|
||||
|
|
|
@ -10,7 +10,8 @@ exports.initialize = function initializeSchema(schema, callback) {
|
|||
schema.settings.options
|
||||
);
|
||||
|
||||
schema.client.auth(schema.settings.password, callback);
|
||||
schema.client.auth(schema.settings.password);
|
||||
schema.client.on('connect', callback);
|
||||
|
||||
schema.adapter = new BridgeToRedis(schema.client);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
var Sequelize = require('sequelize');
|
||||
|
||||
exports.initialize = function initializeSchema(schema) {
|
||||
exports.initialize = function initializeSchema(schema, callback) {
|
||||
schema.adapter = new SequelizeAdapter(schema);
|
||||
callback();
|
||||
};
|
||||
|
||||
function SequelizeAdapter(schema) {
|
||||
|
|
Loading…
Reference in New Issue