Skip to content

Instantly share code, notes, and snippets.

@Grizvok
Created May 29, 2017 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Grizvok/3b048715134f63dddc714216a796cc37 to your computer and use it in GitHub Desktop.
Save Grizvok/3b048715134f63dddc714216a796cc37 to your computer and use it in GitHub Desktop.
function doesUserExist() {
var rowCount;
pg.connect(conString, function (err, client, done) {
client.query('SELECT user_id FROM clients.users where user_id=$1', [req.body.user], function(err, result) {
if (err) {
console.log('error fetching client from pool', err);
}
else if (result.rowCount === 1) {
return rowCount = 1;
}
})
});
return rowCount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment