Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Count

Represents a count query (SELECT COUNT(*)).

Hierarchy

Index

Constructors

constructor

Properties

Protected countCol

countCol: string

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 order

order: OrderBy

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

Methods

buildQuery

count

  • count(col?: string): this
  • Count the number of records, optionally on a column.

    Parameters

    • Optional col: string

      An optional column to count on. If not provided, then COUNT(*) is used.

    Returns this

execute

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

    Returns Promise<number>

    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.

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

toString

  • toString(): string

Generated using TypeDoc