dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

Added support for continuation-local-storage namespaces with the postgres driver #653

Closed benkitzelman closed 8 years ago

benkitzelman commented 8 years ago

Pushed this up for comment..... continuation-local-storage provides a support for namespaces - data containers that exist for the life of bound event emitters...

A number of systems use this to provide for such facilities as contextual logging. For details see https://datahero.com/blog/2014/05/22/node-js-preserving-data-across-async-callbacks/

The pg driver breaks support of this (see at the end of the article) - this PR preserves cls namespaces across async PG calls.