1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Use knex' map()

This commit is contained in:
Jari Bakken 2014-11-14 16:40:13 +01:00
parent 3d52d97f85
commit d591cdad2b
2 changed files with 3 additions and 9 deletions

View File

@ -14,9 +14,7 @@ function getEvents() {
.select(EVENT_COLUMNS)
.from('events')
.orderBy('created_at', 'desc')
.then(function (rows) {
return rows.map(rowToEvent);
});
.map(rowToEvent);
}
function getEventsFilterByName(name) {
@ -25,9 +23,7 @@ function getEventsFilterByName(name) {
.from('events')
.whereRaw("data ->> 'name' = ?", [name])
.orderBy('created_at', 'desc')
.then(function (rows) {
return rows.map(rowToEvent);
});
.map(rowToEvent);
}
function rowToEvent(row) {

View File

@ -26,9 +26,7 @@ function getFeatures() {
.select(FEATURE_COLUMNS)
.from('features')
.orderBy('created_at', 'desc')
.then(function (rows) {
return rows.map(rowToFeature);
});
.map(rowToFeature);
}
function getFeature(name) {