Created
March 9, 2015 23:03
-
-
Save BrianOstrander/608a861a95292e0130d9 to your computer and use it in GitHub Desktop.
An excerpt of a NodeJS API for getting users between two ranks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.getRanks = function(rankMin, rankMax, sinceUTC, callback) { | |
var sql = 'SELECT nickname,shared_identifier,items,experience FROM accounts WHERE ? < date_updated ORDER BY experience DESC LIMIT ?,?'; | |
var sqlParams = [sinceUTC, rankMin, (rankMax - rankMin) + 1]; | |
mysql.query(sql, sqlParams, function (err, result) { | |
if (err) { | |
console.log(err); | |
callback(err, null); | |
} | |
else { | |
callback(null, result); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment