prego

Callback-style node.js+postgres fast migrations, tables and simple associations.

Prego postgres access module

ATTENTION

Prego is under early development. It is published only to extend testing base, it is not yet ready for any usage. I'm going to extend the interfaces a long way and may very likely change a bit existing ones. And for the same reason there is yet no doces.

Prego is a tiny coffeescript library to simplify Postgres database access and manipulation, built for speed in both development and execution, to the extent that first condition allow to meet the second ;)

Main prego features:

  • Callback-style, fast and easy

  • reversible migrations, in plain postgres SQL (well any js/coffee code could be added, too), executed in transactions and reversible if 'down' routine exists.

  • DB access functions like prego.client(), prego.execute(), prego.executeRow() with automatic SQL statement preparation. Uses 'pg' connection pool

  • prego.query to execute multiline parameterless queries without statement preparing. Uses same connection pool.

  • Table base class that simplifies basic operation to access tables, like obtaining from SQL or by id (you should provide field to each table you want to use this feature), track and save changes, convert snake_case column names in db to table.camelCase in objects, load series of rows converting to a Model class (that inherits from Table) automatically, either all the returning row or row-by-row in a callback.

  • Some utility classes to perform parallel operations and manipulate strings, etc.