1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

Use knex' map()

This commit is contained in:
Jari Bakken 2014-11-14 16:40:13 +01:00 committed by Ivar Conradi Østhus
parent 412067c42f
commit 1371560840
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) {