Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.0 Release #54

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open

v1.0.0 Release #54

wants to merge 58 commits into from

Conversation

jrf0110
Copy link
Owner

@jrf0110 jrf0110 commented Jun 7, 2016

Easily composable factory based API:

var db = require('dirac')('postgres://localhost:5432/my_db?ssl=true');

// More specific
var db = require('dirac')
  .host('localhost')
  .port(5432)
  .ssl(true)
  .db('my_db');

// Use middleware for instance
db = require('dirac')('...')
  .use( db.relationships() )
  .use( myCustomMiddlewares );

// Query by strings
db.query('select * from users where id = $1', [10])
  .then( function( results ){
    // Promised based API or node-style callbacks
  });


db.query({
  type: 'select'
, table: 'users'
, where: { id: 10 }
}).then(...);

// Setup dals
db.users = db.dal({ ... });

// Initiate query objects
var query = db.users.find()
  .where({ id: 10 })
  .or({ id: 12 })
  .one({ table: 'region' })
  .many({ table: 'orders' })

query.exec().then( ... );

@jrf0110
Copy link
Owner Author

jrf0110 commented Apr 2, 2015

Arbitrary query composition:

var q1 = dirac.query();

q1.table('orders')
  .where({ status: 'submitted' })
  .order(['id desc'])
  .limit(30);

db.users.find()
  .where.({ id: 10 })
  .many( q1 )

dirac.query() would simply return a fancy mosql object with setters/getters. If it's just called from the base dirac namespace, no connection string or middleware will be associated to it

@jrf0110
Copy link
Owner Author

jrf0110 commented Apr 24, 2015

Place a bigger emphasis on the Relationships helpers

@jrf0110 jrf0110 mentioned this pull request Apr 24, 2015
@jrf0110
Copy link
Owner Author

jrf0110 commented Dec 9, 2015

Stream support with https://github.com/brianc/node-pg-query-stream

db.orders().find()
  .where({ ... })
  .many({ table: 'order_items', alias: 'items' })
  .pipe( res );

Where .pipe would automatically execute the query with a streaming client.

@jrf0110 jrf0110 changed the title v1.0.0 Wishlist v1.0.0 Release Jul 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant