Skip to content

letsface/pgspjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Discover and auto-proxy PostgreSQL stored procedures as a dot-notation fluent interface for Node.JS with a proper transaction interface.

A typical pattern for databases is to not grant direct low-level SELECT/INSERT/UPDATE SQL operations but to grant execute permissions instead on stored procedures in the database server.

This improves:

  • security: GRANT EXECUTE on a per-role basis enforced by the DB
  • code size: one location for business logic
  • performance: less round-trip between database and middleware

This is particularly attractive with more common languages such as Javascript (through plv8) being available in the database.

Dependencies

Usage

  • npm install git+ssh://[email protected]/letsface/pgspjs.git
  • var pgspjs = require('pgspjs');
  • pgspjs.exportStoredProcs(dataSourceName)
  • returns a Q promise to an object with a .transaction()
  • Call transaction() and use dot notation with your stored procedures names

Examples

  • See examples/example1.js

About

Discover and auto-proxy PostgreSQL stored procedures as a dot-notation fluent interface for Node.JS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published