Closed calebcgates closed 6 years ago
I've without exaggeration spent the last few days digging through node-sql trying to answer this question.
What is the syntax to apply an ORDER BY .......... DESC
I would like to add DESC to the .order() found 4 lines below.
listing_processor.js
const functions = require('sql/lib/functions'); const listingListedDate = functions.getFunctions(`dash.listing_listed_date`); query.order(listingListedDate(this._getTable()['data'])); //.descending?
Postgres Function dash.listing_listed_date SELECT (data #>> '{listedDate}')::date
SELECT (data #>> '{listedDate}')::date
query_processor.js
const {listing} = require('../models'); _getTable() { return listing; }
models.js
function defineEntityTable(name){ return sql.define({ name: name, columns: ['entity_id', 'last_update_on', 'data'] }); } module.exports = { listings: defineEntityTable('listings'), };
I figured out the solution. It's pretty much what I expected.
return query.order(listingListedDate(this._getTable()[filterDataColumnName]).descending());
I've without exaggeration spent the last few days digging through node-sql trying to answer this question.
What is the syntax to apply an ORDER BY .......... DESC
I would like to add DESC to the .order() found 4 lines below.
listing_processor.js
Postgres Function dash.listing_listed_date
SELECT (data #>> '{listedDate}')::date
query_processor.js
models.js