1.0.1 • Published 8 years ago

common-storage-driver-postgresql v1.0.1

Weekly downloads
9
License
-
Repository
github
Last release
8 years ago

Common Storage PostgreSQL Driver

A PostgreSQL driver for Common Storage, part of the Common Framework. It uses node-postgres.

Installation

Install it from NPM:

npm install common-storage-driver-postgresql

Usage

First, connect to a database using the acquireDatabase(options) method. The argument should be an object and conform to what is accepted by the connect method in node-postgres. It returns a promise:

commonStorageDriverPostgreSQL.acquireDatabase({
	database: "postgres",
    host: "localhost"
}).then(function(database) {
	...

Next, fetch a table from the database:

	...
	return database.fetchTable("postgres");
}).then(function(table) {
	/* Use the table here */
});

A description of the table object can be found in the SQL helper package.