Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Select<T>

Represents a SELECT query.

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

Protected colStore

colStore: ColumnStore

Used for accessing columns in tables.

Protected escaper

escaper: Escaper

An Escaper matching the database type (e.g. MySQLEscaper or MSSQLEscaper). Used when escaping column names in compiled conditions.

Protected executer

executer: Executer

An Executer instance that matches the database type (e.g. MySQLExecuter).

Protected from

from: From

A From instance which holds the base table, all joined-in tables, and the where clause.

Protected offset

offset: number

Protected order

order: OrderBy

An OrderBy instance which is optionally used to order the query results.

Protected rowCount

rowCount: number

Protected selectCols

selectCols: Map<string, FromColumnMeta> = new Map()

Methods

buildQuery

execute

  • execute(): Promise<T[]>
  • Execute the query and return an array of results of type T.

    Returns Promise<T[]>

    A promise that shall be resolved with the normalized query results of type T. If an error occurs while executing the query, the returned promise shall be rejected with the unmodified error.

getSelectString

  • getSelectString(): string

limit

  • limit(rowCount: number): this
  • limit(limitOrOffset: number, rowCount: number): this
  • Limit the number of rows returned.

    Parameters

    • rowCount: number

      The number of rows to return.

    Returns this

  • Limit the number of rows returned with an offset.

    Parameters

    • limitOrOffset: number
    • rowCount: number

      The number of rows to return.

    Returns this

orderBy

  • Order by one or more columns.

    Parameters

    • Rest ...orders: OrderByType[] | string[]

      A list of fully-qualified properties in the form <table-alias>.<property>, or an array of OrderByType with the fully-qualified property and direction.

    Returns this

select

  • select(...cols: string[]): this
  • Select columns manually.

    Parameters

    • Rest ...cols: string[]

      An optional set of columns to select. Each argument should be a fully-qualified property name in the form <table-alias>.<property>. If no columns are specified, then all columns are selected.

    Returns this

Abstract toString

  • toString(): string

Generated using TypeDoc