Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Select = function (){};
- Select.prototype.launch = function (cstring,fn){
- client = new pg.Client(cstring);
- client.connect(function(err){
- if (err) return fn(err);
- });
- client.query("SELECT * FROM uuid_audit_table;",function(err,result){
- if (err) return fn(err);
- if (result.rows[0]){
- return fn(null, result.rows[0]);
- } else {
- return fn(null,"");
- }
- });
- };
- ### then called inside topic this way:
- 'we try to make a select': {
- topic: function () {
- var select = new Select;
- select.launch(connString,this.callback);
- },
- 'we get some data': function(topic) {
- //console.log(topic);
- assert.isNotNull(topic[1]);
- client.end();
- },
- 'and no error': function(topic){
- assert.isUndefined(topic[0]);
- client.end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement