drivers/mysql.js
function MySQL(config) {
  
  var self = this;
  
  config = config || {};
  config.host = config.host || 'localhost';
  config.port = config.port || 3306;
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = mysql.createConnection(config);

  // Assign storage
  if (typeof config.storage == 'string') {
    this.storage = app.getResource('storages/' + config.storage);
  } else if (config.storage instanceof protos.lib.storage) {
    this.storage = config.storage;
  }
  
  // Set db
  this.db = config.database;
      
  // Only set important properties enumerable
  protos.util.onlySetEnumerable(this, ['className', 'db']);
  
}
function MySQL(config) {
  
  var self = this;
  
  config = config || {};
  config.host = config.host || 'localhost';
  config.port = config.port || 3306;
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = mysql.createConnection(config);

  // Assign storage
  if (typeof config.storage == 'string') {
    this.storage = app.getResource('storages/' + config.storage);
  } else if (config.storage instanceof protos.lib.storage) {
    this.storage = config.storage;
  }
  
  // Set db
  this.db = config.database;
      
  // Only set important properties enumerable
  protos.util.onlySetEnumerable(this, ['className', 'db']);
  
}
function MySQL ( config ) { var self = this ; config = config || { } ; config . host = config . host || 'localhost' ; config . port = config . port || 3306 ; this . className = this . constructor . name ; this . config = config ; // Set client this . client = mysql . createConnection ( config ) ; // Assign storage if ( typeof config . storage == 'string' ) { this . storage = app . getResource ( 'storages/' + config . storage ) ; } else if ( config . storage instanceof protos . lib . storage ) { this . storage = config . storage ; } // Set db this . db = config . database ; // Only set important properties enumerable protos . util . onlySetEnumerable ( this , [ 'className' , 'db' ] ) ; }
MySQL Driver class

Driver configuration

config: {
host: 'localhost',
port: 3306,
user: 'db_user',
password: 'db_password',
database: 'db_name',
debug: false,
storage: 'redis'
}

@class MySQL
@extends Driver
@constructor
@param {object} app Application instance
@param {object} config Driver configuration
MySQL Driver class