Skip to content

bvalosek/billy-sql-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

billy-sql-postgres

Build Status NPM version

A Billy service that allows for executing queries against a PostgreSQL database.

Install

$ npm install billy-sql-postgres

Usage

var Application = require('billy');
var SqlService  = require('billy-sql-postgres');

var app = new Application();

app.service(SqlService);
app.config('postgres.url', 'posgres://user:pw@127.0.0.1:5432');

Use the sql dependency in any service or other injected objects:

app.service(function(sql) {
  sql.query('select * from widgets').then(function(rows) {
    ...
  });
});

Queries are all queued and executed via connections from the internal connection pool on the pg global object.

Injectables

New dependencies that you can use after adding this service:

tag type description notes
sql PostgresFacade The generic SQL interface Promise-based query interface

Configs

Available config properties:

config type description default value notes
postgres.url string The connection string null The service will error out if not provided

Testing

$ npm test

License

MIT

About

A Billy service that connects to a PostgreSQL database

Resources

License

Stars

Watchers

Forks

Packages

No packages published