Home / File/ select.ts — drizzle-orm Source File

select.ts — drizzle-orm Source File

Architecture documentation for select.ts, a typescript file in the drizzle-orm codebase. 3 imports, 0 dependents.

File typescript DrizzleORM SQLDialects 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  7941083e_097f_1d7e_1c38_777ce9bcb0a2["select.ts"]
  7bd0ba6a_93b0_0df7_7f87_d1a726b246cb["column.ts"]
  7941083e_097f_1d7e_1c38_777ce9bcb0a2 --> 7bd0ba6a_93b0_0df7_7f87_d1a726b246cb
  99347ab2_b1a1_faf4_e37c_7643e4b2eb8a["sql.ts"]
  7941083e_097f_1d7e_1c38_777ce9bcb0a2 --> 99347ab2_b1a1_faf4_e37c_7643e4b2eb8a
  eb432528_5e12_9f5b_6ed4_4aeab03024d8["sql"]
  7941083e_097f_1d7e_1c38_777ce9bcb0a2 --> eb432528_5e12_9f5b_6ed4_4aeab03024d8
  style 7941083e_097f_1d7e_1c38_777ce9bcb0a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { AnyColumn } from '../../column.ts';
import type { SQL, SQLWrapper } from '../sql.ts';
import { sql } from '../sql.ts';

/**
 * Used in sorting, this specifies that the given
 * column or expression should be sorted in ascending
 * order. By the SQL standard, ascending order is the
 * default, so it is not usually necessary to specify
 * ascending sort order.
 *
 * ## Examples
 *
 * ```ts
 * // Return cars, starting with the oldest models
 * // and going in ascending order to the newest.
 * db.select().from(cars)
 *   .orderBy(asc(cars.year));
 * ```
 *
 * @see desc to sort in descending order
 */
export function asc(column: AnyColumn | SQLWrapper): SQL {
	return sql`${column} asc`;
}

/**
 * Used in sorting, this specifies that the given
 * column or expression should be sorted in descending
 * order.
 *
 * ## Examples
 *
 * ```ts
 * // Select users, with the most recently created
 * // records coming first.
 * db.select().from(users)
 *   .orderBy(desc(users.createdAt));
 * ```
 *
 * @see asc to sort in ascending order
 */
export function desc(column: AnyColumn | SQLWrapper): SQL {
	return sql`${column} desc`;
}

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does select.ts do?
select.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in select.ts?
select.ts defines 2 function(s): asc, desc.
What does select.ts depend on?
select.ts imports 3 module(s): column.ts, sql, sql.ts.
Where is select.ts in the architecture?
select.ts is located at drizzle-orm/src/sql/expressions/select.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/sql/expressions).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free