Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created January 6, 2012 20:20
Show Gist options
  • Select an option

  • Save joshsmith/1572237 to your computer and use it in GitHub Desktop.

Select an option

Save joshsmith/1572237 to your computer and use it in GitHub Desktop.
var table = 'companies';
var Company = function() {
}
// Get company with just their email address
Company.prototype.getByEmail = function (email, callback) {
client.query(
'SELECT * FROM ' + table +
' WHERE email = ?',
[ email ],
function selectCb(err, results, fields) {
if(err) {
callback(err);
} else {
callback(null, results);
}
}
);
}
module.exports = Company;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment