lib/postgrestore.js
function PostgreStore(conString, options) {
    if(!conString){
        throw new Error('Connection String is missing.');
    }

    this._options = options || {};
    this._options.pgstore = this._options.pgstore || {};
    this._difficulty = this._options.pgstore.difficulty || 10;
	this._table = this._options.pgstore.table || 'passwordless';

    this._client = new pg.Pool({
        connectionString: conString,
        max: this._options.pgstore.pgPoolSize || 10
    });

    if(!isNumber(this._difficulty) || this._cost < 1) {
        throw new Error('bcrypt difficulty must be an integer >= 1');
    }

    delete this._options.pgstore;

    var self = this;
    this._client.connect(function(err, client) {
        if(err) {
            throw new Error('Could not connect to Postgres database, with error : ' + err);
        }
    });
}
function PostgreStore(conString, options) {
    if(!conString){
        throw new Error('Connection String is missing.');
    }

    this._options = options || {};
    this._options.pgstore = this._options.pgstore || {};
    this._difficulty = this._options.pgstore.difficulty || 10;
	this._table = this._options.pgstore.table || 'passwordless';

    this._client = new pg.Pool({
        connectionString: conString,
        max: this._options.pgstore.pgPoolSize || 10
    });

    if(!isNumber(this._difficulty) || this._cost < 1) {
        throw new Error('bcrypt difficulty must be an integer >= 1');
    }

    delete this._options.pgstore;

    var self = this;
    this._client.connect(function(err, client) {
        if(err) {
            throw new Error('Could not connect to Postgres database, with error : ' + err);
        }
    });
}
function PostgreStore ( conString , options ) { if ( ! conString ) { throw new Error ( 'Connection String is missing.' ) ; } this . _options = options || { } ; this . _options . pgstore = this . _options . pgstore || { } ; this . _difficulty = this . _options . pgstore . difficulty || 10 ; this . _table = this . _options . pgstore . table || 'passwordless' ; this . _client = new pg . Pool ( { connectionString : conString , max : this . _options . pgstore . pgPoolSize || 10 } ) ; if ( ! isNumber ( this . _difficulty ) || this . _cost < 1 ) { throw new Error ( 'bcrypt difficulty must be an integer >= 1' ) ; } delete this . _options . pgstore ; var self = this ; this . _client . connect ( function ( err , client ) { if ( err ) { throw new Error ( 'Could not connect to Postgres database, with error : ' + err ) ; } } ) ; }
Constructor of PostgreStore
@param {String} conString URI as defined by the PostgreSQL specification. Please
check the documentation for details:
https://github.com/brianc/node-postgres
@param {Object} [options] Combines both the options for the PostgreClient as well
as the options for PostgreStore. For the PostgreClient options please refer back to
the documentation. PostgreStore understands the following options:
(1) { pgstore: { difficulty: integer }} to change the bcrypt difficulty. Defaults to: 10
(1) { pgstore: { table: string }} to change the name of the table used. Defaults to: 'passwordless'
(2) { pgstore: { pgPoolSize: integer }} to change the pool size of PostgreSQL client. Defaults to: 10
@constructor
Constructor of PostgreStore