Postgresql.listRecords()

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

Usage

Hover over inputs/exits for more info.

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


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

Postgresql.listRecords({

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

table: 'direwolves',

schema: [],

query: {},

limit: 30,

skip: 30,

sort: [],

}).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 () {

 

},

});

Inputs

connectionUrl required

The postgresql connection URL

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

The name of the table.

'direwolves'
schema required

An example indicating what each returned row should look like.

query

The selection criteria (like the WHERE clause)

limit

If specified, limits number of rows returned in the query (useful for pagination)

30
skip

If specified, skips N rows ahead in the query (useful for pagination)

30
sort

If specified, the rows coming back from the query will be sorted according to this dictionary.

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.

(varies based on provided inputs)