Postgresql.countRecords()

Count records in the Postgresql table that match the specified criteria.

Usage

Hover over inputs/exits for more info.

var Postgresql = require('machinepack-postgresql');


// Count records in the Postgresql table that match the specified criteria.

Postgresql.countRecords({

connectionUrl: 'postgres://foo:bar@localhost:5432/machinepack_postgresql',

table: 'direwolves',

query: {},

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Could not connect to Postgresql server at specified `connectionUrl`.

couldNotConnect: function () {

 

},

// Provided `table` input is not a valid name for a Postgresql table.

invalidCollection: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

connectionUrl required

The postgresql connection URL

'postgres://foo:bar@localhost:5432/machinepack_postgresql'
table required

The name of the table.

'direwolves'
query

The selection criteria (like the WHERE clause)

Exits

error

An unexpected error occurred.

couldNotConnect

Could not connect to Postgresql server at specified `connectionUrl`.

invalidCollection

Provided `table` input is not a valid name for a Postgresql table.

success

OK.

123