10 examples of 'sequelize order by' in JavaScript

Every line of 'sequelize order by' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
201orderBy(...args) {
202 this._builder.orderBy(...args)
203
204 return this
205}
239order(order) {
240 return (new Query(this)).order(order);
241}
233orderBy(column: K | [string | K, Direction][], direction: Direction = 'ASC') {
234 if (typeof column === 'string') {
235 column = [[column, direction]];
236 }
237 this.components.orders = column as [string, Direction][];
238
239 return this;
240}
195sort(orderby, order) {
196 const sort = parseArgs(orderby, order);
197 const fn = this._schema._execSort(sort);
198
199 return new this.constructor(this.data.slice().sort(fn));
200}
279function buildOrderBy(order) {
280 if (typeof order === 'string') order = [order];
281 return 'ORDER BY ' + order.join(', ');
282}
66orderByDesc(field) {
67 this.isUsed = true;
68 this.ordering[this.getFieldByName(field)] = 'desc';
69 return this;
70}
61set sortOrder(s) {
62 this.params.sortOrder = s.join(',');
63}
174orderBy (orderPartsArray) {
175 if (orderPartsArray.length > 0) {
176 return `ORDER BY ${orderPartsArray.join(',')}`
177 } else {
178 return ''
179 }
180}
149private orderBy(x) {
150 this.orderKey = x;
151 this.observableValue.sort((a, b) => {
152 const itemA = a[x];
153 const itemB = b[x];
154 if (itemA < itemB) { return -1; }
155 if (itemA > itemB) { return 1; }
156 return 0;
157 });
158}
101public order(field, direction = 'ASC') {
102
103 this._order = StringUtil.format(`{0} {1}`, field, direction);
104
105 return this;
106
107}

Related snippets