docs
docs copied to clipboard
API JS - r.connect and r.close
See http://pastebin.com/GGqiqbKu
We should actually write a whole example on how to connect, bind listeners for errors, run a query, close the connection.
We should probably write about using/disposer -- https://github.com/petkaantonov/bluebird/blob/master/API.md#promiseusingpromisedisposer-promise-promisedisposer-promise--function-handler---promise
I have to tests a few things, but I should be able to provide some snippets.
Just pasting a snippet I used (with bind).
r.connect({}).bind({}).then(function(conn) {
this.conn = conn;
return query.run(this.conn);
}).then(function(result) {
// do things with result
}).error(function(err) {
// handle error
}).finally(function() {
if (this.conn) {
this.conn.close();
}
})