osr
Version:
osr
23 lines (21 loc) • 653 B
JavaScript
var Mongo = require("./mongo");
var Redis = require("./redis");
var MQ = require("./mq");
var RedisMQ = require("./redismq");
var Dao = function(type,options){
this.type = type;
this.options = options;
}
Dao.prototype.getConn = function(){
if("mongo" === this.type){
this.conn = new Mongo(this.options);
}else if("redis" === this.type){
this.conn = new Redis(this.options);
}else if("mq" === this.type){
this.conn = new MQ(this.options);
}else if("redismq" === this.type){
this.conn = new RedisMQ(this.options);
}
return this.conn;
}
module.exports = exports = Dao;