Skip to main content
Module

x/denodb/mod.ts>Model.orderBy

MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Go to Latest
method Model.orderBy
import { Model } from "https://deno.land/x/denodb@v1.0.40/mod.ts";

Order query results based on a field name and an optional direction.

await Flight.orderBy("departure").all();

await Flight.orderBy("departure", "desc").all();

await Flight.orderBy({ departure: "desc", destination: "asc" }).all();

Type Parameters

T extends ModelSchema

Parameters

this: T
fieldOrFields: string | OrderByClauses
optional
orderDirection: OrderDirection = [UNSUPPORTED]