Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains all properties of the QueryBuilder that needs to be build a final query.

Hierarchy

  • QueryExpressionMap

Index

Constructors

constructor

Properties

aliasNamePrefixingEnabled

aliasNamePrefixingEnabled: boolean = true

Indicates if property names are prefixed with alias names during property replacement. By default this is enabled, however we need this because aliases are not supported in UPDATE and DELETE queries, but user can use them in WHERE expressions.

aliases

aliases: Alias[] = []

All aliases (including main alias) used in the query.

cache

cache: boolean = false

Indicates if query result cache is enabled or not.

cacheDuration

cacheDuration: number

Time in milliseconds in which cache will expire. If not set then global caching time will be used.

cacheId

cacheId: string

Cache id. Used to identifier your cache queries.

callListeners

callListeners: boolean = true

Indicates if listeners and subscribers must be called before and after query execution.

Protected connection

connection: Connection

disableEscaping

disableEscaping: boolean = true

Indicates if alias, table names and column names will be ecaped by driver, or not.

todo: rename to isQuotingDisabled, also think if it should be named "escaping"

enableRelationIdValues

enableRelationIdValues: boolean = false

Indicates if virtual columns should be included in entity result.

todo: what to do with it? is it properly used? what about persistence?

extraAppendedAndWhereCondition

extraAppendedAndWhereCondition: string = ""

Extra where condition appended to the end of original where conditions with AND keyword. Original condition will be wrapped into brackets.

extraReturningColumns

extraReturningColumns: ColumnMetadata[] = []

Extra returning columns to be added to the returning statement if driver supports it.

groupBys

groupBys: string[] = []

GROUP BY queries.

havings

havings: object[] = []

HAVING queries.

insertColumns

insertColumns: string[] = []

List of columns where data should be inserted. Used in INSERT query.

joinAttributes

joinAttributes: JoinAttribute[] = []

JOIN queries.

Optional limit

limit: undefined | number

LIMIT query.

Optional lockMode

lockMode: "optimistic" | "pessimistic_read" | "pessimistic_write"

Locking mode.

Optional lockVersion

lockVersion: number | Date

Current version of the entity, used for locking.

Optional mainAlias

mainAlias: Alias

Main alias is a main selection object selected by QueryBuilder.

nativeParameters

nativeParameters: ObjectLiteral

Extra parameters. Used in InsertQueryBuilder to avoid default parameters mechanizm and execute high performance insertions.

of

of: any | any[]

Entity (target) which relations will be updated.

Optional offset

offset: undefined | number

OFFSET query.

onConflict

onConflict: string = ""

Optional on conflict statement used in insertion query in postgres.

options

options: SelectQueryBuilderOption[] = []

Options that define QueryBuilder behaviour.

orderBys

ORDER BY queries.

parameters

parameters: ObjectLiteral

Parameters used to be escaped in final query.

parentQueryBuilder

parentQueryBuilder: QueryBuilder<any>

If QueryBuilder was created in a subquery mode then its parent QueryBuilder (who created subquery) will be stored here.

queryEntity

queryEntity: boolean = false

Indicates if QueryBuilder used to select entities and not a raw results.

queryType

queryType: "select" | "update" | "delete" | "insert" | "relation" = "select"

Represents query type. QueryBuilder is able to build SELECT, UPDATE and DELETE queries.

relationCountAttributes

relationCountAttributes: RelationCountAttribute[] = []

Relation count queries.

relationIdAttributes

relationIdAttributes: RelationIdAttribute[] = []

RelationId queries.

relationPropertyPath

relationPropertyPath: string

Property path of relation to work with. Used in relational query builder.

returning

returning: string | string[]

Optional returning (or output) clause for insert, update or delete queries.

selects

selects: SelectQuery[] = []

Data needs to be SELECT-ed.

Optional skip

skip: undefined | number

Number of rows to skip of result using pagination.

subQuery

subQuery: boolean = false

Indicates if query builder creates a subquery.

Optional take

take: undefined | number

Number of rows to take using pagination.

updateEntity

updateEntity: boolean = true

Indicates if entity must be updated after insertion / updation. This may produce extra query or use RETURNING / OUTPUT statement (depend on database).

useTransaction

useTransaction: boolean = false

Indicates if query must be wrapped into transaction.

Optional valuesSet

If update query was used, it needs "update set" - properties which will be updated by this query. If insert query was used, it needs "insert set" - values that needs to be inserted.

whereEntities

whereEntities: ObjectLiteral[] = []

Used if user wants to update or delete a specific entities.

wheres

wheres: object[] = []

WHERE queries.

Accessors

allOrderBys

  • get allOrderBys(): object
  • Get all ORDER BY queries - if order by is specified by user then it uses them, otherwise it uses default entity order by if it was set.

    Returns object

    • [columnName: string]: "ASC" | "DESC" | object

relationMetadata

Methods

clone

createAlias

  • createAlias(options: object): Alias
  • Creates a new alias and adds it to the current expression map.

    Parameters

    • options: object
      • Optional metadata?: EntityMetadata
      • Optional name?: undefined | string
      • Optional subQuery?: undefined | string
      • Optional tablePath?: undefined | string
      • Optional target?: Function | string
      • type: "from" | "select" | "join" | "other"

    Returns Alias

findAliasByName

  • findAliasByName(aliasName: string): Alias

findColumnByAliasExpression

  • findColumnByAliasExpression(aliasExpression: string): ColumnMetadata | undefined

setMainAlias

Generated using TypeDoc