drivers/postgres.js
function PostgreSQL(config) {

  var self = this;

  config = protos.extend({
    host: 'localhost',
    port: 5432
  }, config);
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = new Client(config);

  // Connect client
  this.client.connect();

  // 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 PostgreSQL(config) {

  var self = this;

  config = protos.extend({
    host: 'localhost',
    port: 5432
  }, config);
  
  this.className = this.constructor.name;
  
  this.config = config;
  
  // Set client
  this.client = new Client(config);

  // Connect client
  this.client.connect();

  // 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 PostgreSQL ( config ) { var self = this ; config = protos . extend ( { host : 'localhost' , port : 5432 } , config ) ; this . className = this . constructor . name ; this . config = config ; // Set client this . client = new Client ( config ) ; // Connect client this . client . connect ( ) ; // 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' ] ) ; }
PostgreSQL Driver class

Driver configuration

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

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