pg-simple

0.2.2 • Public • Published

pg-simple

###A simpler interface to node-postgres

Don't worry anymore about this type of thing:

pg.connect(connString, function(err, client, done) {
	if(err) throw err;
	client.query(query, values, function(err, result) {
		if(err) throw err;
		// Do things with result
	})
})

With pg-simple, you can now just do:

pg.connect(connString); // You have to do this just once, as it will be stored by pg-simple
pg.error(function(err) { // Define a handler for any error that might occur. Also just once.
	throw err;
})
pg.query(query, values, function(err, result) {
	// No error handler, as we have defined one with pg.error()
	// Note that an error may be passed, when no handler has been set with pg.error())
	// Do things with result
})

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i pg-simple

    Weekly Downloads

    39

    Version

    0.2.2

    License

    MIT

    Last publish

    Collaborators

    • tuur