select.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import type { AnyColumn } from "../../column.js";
  2. import type { SQL, SQLWrapper } from "../sql.js";
  3. /**
  4. * Used in sorting, this specifies that the given
  5. * column or expression should be sorted in ascending
  6. * order. By the SQL standard, ascending order is the
  7. * default, so it is not usually necessary to specify
  8. * ascending sort order.
  9. *
  10. * ## Examples
  11. *
  12. * ```ts
  13. * // Return cars, starting with the oldest models
  14. * // and going in ascending order to the newest.
  15. * db.select().from(cars)
  16. * .orderBy(asc(cars.year));
  17. * ```
  18. *
  19. * @see desc to sort in descending order
  20. */
  21. export declare function asc(column: AnyColumn | SQLWrapper): SQL;
  22. /**
  23. * Used in sorting, this specifies that the given
  24. * column or expression should be sorted in descending
  25. * order.
  26. *
  27. * ## Examples
  28. *
  29. * ```ts
  30. * // Select users, with the most recently created
  31. * // records coming first.
  32. * db.select().from(users)
  33. * .orderBy(desc(users.createdAt));
  34. * ```
  35. *
  36. * @see asc to sort in ascending order
  37. */
  38. export declare function desc(column: AnyColumn | SQLWrapper): SQL;