Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FromAdapter<T>

Adapter for the From class that exposes a nice user interface for Select, Delete, and Update, all of which depend on a From instance.

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 propStore

propStore: PropertyMapStore

Used for pulling table property maps (used in conjunction with the relStore to get remote columns).

Protected relStore

Used for accessing relationships between tables.

Protected tblStore

tblStore: TableStore

Used for accessing tables in the database.

Methods

count

  • count(col?: string): Count
  • Get the record count from a table.

    Parameters

    • Optional col: string

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

    Returns Count

delete

  • delete(alias?: string): Delete
  • Delete from a table. See Delete.

    Parameters

    • Optional alias: string

      The unique alias of the table from which records will be deleted. Optional, defaults to the alias of the from table.

    Returns Delete

    A Delete instance that can be executed.

getBaseTableMeta

getFromMeta

getFromString

  • getFromString(): string
  • Get the FROM portion of the query as a string.

    Returns string

    The FROM portion of the query (FROM <table> AS <alias>), escaped.

getJoinMeta

  • Helper method to get the meta data of the JOIN'd in tables.

    Returns FromTableMeta[]

    An array of meta objects describing each table. The meta objects are in insertion order (e.g. in the order the tables were joined in).

getJoinString

  • getJoinString(): string

getParameterList

getWhereString

  • getWhereString(): string
  • Get the WHERE portion of the query string.

    Returns string

    The WHERE part of the query, or a blank string if there is no where clause.

innerJoin

join

  • Join in a table.

    Type parameters

    • J

    Parameters

    Returns this

  • Join in a table.

    Type parameters

    • J

    Parameters

    • joinType: JoinType

      How to join the two tables (INNER JOIN, LEFT OUTER JOIN).

    • Entity: TableType

      The Table-decorated Entity to join in.

    • alias: string

      Alias of the joined-in table.

    • fqParentProperty: string

      The fully-qualified property name on the parent Entity to which this Entity will be mapped.

    • Optional joinCond: object

      An optional condition that describes how to join the two tables. If not supplied then the join condition will be derived.

    • Optional joinParams: ParameterType

      An optional set of parameters that will be used to replace values in joinCond.

    Returns this

leftOuterJoin

Abstract select

  • select(...cols: string[]): Select<T>

toString

  • toString(): string

Abstract update

where

Generated using TypeDoc