Version: 4.3

Class: QueryBuilderHelper

Hierarchy

  • QueryBuilderHelper

Constructors

constructor

+ new QueryBuilderHelper(entityName: string, alias: string, aliasMap: Dictionary<string>, subQueries: Dictionary<string>, metadata: MetadataStorage, knex: Knex, platform: Platform): QueryBuilderHelper

Defined in packages/knex/src/query/QueryBuilderHelper.ts:10

Parameters:

NameType
entityNamestring
aliasstring
aliasMapDictionary<string>
subQueriesDictionary<string>
metadataMetadataStorage
knexKnex
platformPlatform

Returns: QueryBuilderHelper

Properties

alias

Private Readonly alias: string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:13


aliasMap

Private Readonly aliasMap: Dictionary<string>

Defined in packages/knex/src/query/QueryBuilderHelper.ts:14


entityName

Private Readonly entityName: string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:12


knex

Private Readonly knex: Knex

Defined in packages/knex/src/query/QueryBuilderHelper.ts:17


metadata

Private Readonly metadata: MetadataStorage

Defined in packages/knex/src/query/QueryBuilderHelper.ts:16


platform

Private Readonly platform: Platform

Defined in packages/knex/src/query/QueryBuilderHelper.ts:18


subQueries

Private Readonly subQueries: Dictionary<string>

Defined in packages/knex/src/query/QueryBuilderHelper.ts:15

Methods

appendGroupCondition

PrivateappendGroupCondition(type: QueryType, qb: KnexQueryBuilder, operator: "$and" | "$or", method: "where" | "having", subCondition: any[]): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:496

Parameters:

NameType
typeQueryType
qbKnexQueryBuilder
operator"$and" | "$or"
method"where" | "having"
subConditionany[]

Returns: void


appendJoinClause

PrivateappendJoinClause(clause: JoinClause, cond: Dictionary, operator?: "$and" | "$or"): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:347

Parameters:

NameType
clauseJoinClause
condDictionary
operator?"$and" | "$or"

Returns: void


appendJoinSubClause

PrivateappendJoinSubClause(clause: JoinClause, cond: Dictionary, key: string, operator?: "$and" | "$or"): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:365

Parameters:

NameType
clauseJoinClause
condDictionary
keystring
operator?"$and" | "$or"

Returns: void


appendQueryCondition

appendQueryCondition(type: QueryType, cond: any, qb: KnexQueryBuilder, operator?: "$and" | "$or", method?: "where" | "having"): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:238

Parameters:

NameTypeDefault value
typeQueryType-
condany-
qbKnexQueryBuilder-
operator?"$and" | "$or"-
method"where" | "having""where"

Returns: void


appendQuerySubCondition

PrivateappendQuerySubCondition(qb: KnexQueryBuilder, type: QueryType, method: "where" | "having", cond: any, key: string, operator?: "$and" | "$or"): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:259

Parameters:

NameType
qbKnexQueryBuilder
typeQueryType
method"where" | "having"
condany
keystring
operator?"$and" | "$or"

Returns: void


fieldName

PrivatefieldName(field: string, alias?: string): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:520

Parameters:

NameType
fieldstring
alias?string

Returns: string


finalize

finalize(type: QueryType, qb: KnexQueryBuilder, meta?: EntityMetadata): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:431

Parameters:

NameType
typeQueryType
qbKnexQueryBuilder
meta?EntityMetadata

Returns: void


getLockSQL

getLockSQL(qb: KnexQueryBuilder, lockMode?: LockMode): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:448

Parameters:

NameType
qbKnexQueryBuilder
lockMode?LockMode

Returns: void


getOperatorReplacement

PrivategetOperatorReplacement(op: string, value: Dictionary): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:333

Parameters:

NameType
opstring
valueDictionary

Returns: string


getProperty

PrivategetProperty(field: string, alias?: string): EntityProperty | undefined

Defined in packages/knex/src/query/QueryBuilderHelper.ts:535

Parameters:

NameType
fieldstring
alias?string

Returns: EntityProperty | undefined


getQueryOrder

getQueryOrder(type: QueryType, orderBy: FlatQueryOrderMap, populate: Dictionary<string>): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:403

Parameters:

NameType
typeQueryType
orderByFlatQueryOrderMap
populateDictionary<string>

Returns: string


getRegExpParam

getRegExpParam(re: RegExp): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:215

Parameters:

NameType
reRegExp

Returns: string


getTableName

getTableName(entityName: string): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:198

Parameters:

NameType
entityNamestring

Returns: string


isOneToOneInverse

isOneToOneInverse(field: string): boolean

Defined in packages/knex/src/query/QueryBuilderHelper.ts:191

Parameters:

NameType
fieldstring

Returns: boolean


isPrefixed

PrivateisPrefixed(field: string): boolean

Defined in packages/knex/src/query/QueryBuilderHelper.ts:516

Parameters:

NameType
fieldstring

Returns: boolean


isSimpleRegExp

isSimpleRegExp(re: any): boolean

Defined in packages/knex/src/query/QueryBuilderHelper.ts:206

Checks whether the RE can be rewritten to simple LIKE query

Parameters:

NameType
reany

Returns: boolean


joinManyToManyReference

joinManyToManyReference(prop: EntityProperty, ownerAlias: string, alias: string, pivotAlias: string, type: "leftJoin" | "innerJoin" | "pivotJoin", cond: Dictionary, path: string): Dictionary<JoinOptions>

Defined in packages/knex/src/query/QueryBuilderHelper.ts:124

Parameters:

NameType
propEntityProperty
ownerAliasstring
aliasstring
pivotAliasstring
type"leftJoin" | "innerJoin" | "pivotJoin"
condDictionary
pathstring

Returns: Dictionary<JoinOptions>


joinManyToOneReference

joinManyToOneReference(prop: EntityProperty, ownerAlias: string, alias: string, type: "leftJoin" | "innerJoin" | "pivotJoin", cond?: Dictionary): JoinOptions

Defined in packages/knex/src/query/QueryBuilderHelper.ts:115

Parameters:

NameTypeDefault value
propEntityProperty-
ownerAliasstring-
aliasstring-
type"leftJoin" | "innerJoin" | "pivotJoin"-
condDictionary{}

Returns: JoinOptions


joinOneToReference

joinOneToReference(prop: EntityProperty, ownerAlias: string, alias: string, type: "leftJoin" | "innerJoin" | "pivotJoin", cond?: Dictionary): JoinOptions

Defined in packages/knex/src/query/QueryBuilderHelper.ts:101

Parameters:

NameTypeDefault value
propEntityProperty-
ownerAliasstring-
aliasstring-
type"leftJoin" | "innerJoin" | "pivotJoin"-
condDictionary{}

Returns: JoinOptions


joinPivotTable

joinPivotTable(field: string, prop: EntityProperty, ownerAlias: string, alias: string, type: "leftJoin" | "innerJoin" | "pivotJoin", cond?: Dictionary): JoinOptions

Defined in packages/knex/src/query/QueryBuilderHelper.ts:150

Parameters:

NameTypeDefault value
fieldstring-
propEntityProperty-
ownerAliasstring-
aliasstring-
type"leftJoin" | "innerJoin" | "pivotJoin"-
condDictionary{}

Returns: JoinOptions


mapJoinColumns

mapJoinColumns(type: QueryType, join: JoinOptions): (string | Raw)[]

Defined in packages/knex/src/query/QueryBuilderHelper.ts:178

Parameters:

NameType
typeQueryType
joinJoinOptions

Returns: (string | Raw)[]


mapper

mapper(field: string, type?: QueryType): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:20

Parameters:

NameType
fieldstring
type?QueryType

Returns: string

mapper(field: string, type?: QueryType, value?: any, alias?: string): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:21

Parameters:

NameType
fieldstring
type?QueryType
value?any
alias?string

Returns: string


prefix

Privateprefix(field: string, always?: boolean): string

Defined in packages/knex/src/query/QueryBuilderHelper.ts:485

Parameters:

NameTypeDefault value
fieldstring-
alwaysbooleanfalse

Returns: string


processCustomExpression

PrivateprocessCustomExpression<T>(clause: any, m: string, key: string, cond: any, type?: QueryType): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:283

Type parameters:

NameTypeDefault
Tany[]any[]

Parameters:

NameTypeDefault value
clauseany-
mstring-
keystring-
condany-
typeQueryTypeQueryType.SELECT

Returns: void


processData

processData(data: Dictionary, convertCustomTypes: boolean, multi?: boolean): any

Defined in packages/knex/src/query/QueryBuilderHelper.ts:58

Parameters:

NameTypeDefault value
dataDictionary-
convertCustomTypesboolean-
multibooleanfalse

Returns: any


processJoins

processJoins(qb: KnexQueryBuilder, joins: Dictionary<JoinOptions>): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:162

Parameters:

NameType
qbKnexQueryBuilder
joinsDictionary<JoinOptions>

Returns: void


processObjectSubClause

PrivateprocessObjectSubClause(cond: any, key: string, clause: JoinClause, m: "andOn" | "orOn"): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:384

Parameters:

NameType
condany
keystring
clauseJoinClause
m"andOn" | "orOn"

Returns: void


processObjectSubCondition

PrivateprocessObjectSubCondition(cond: any, key: string, qb: KnexQueryBuilder, method: "where" | "having", m: "where" | "orWhere" | "having", type: QueryType): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:298

Parameters:

NameType
condany
keystring
qbKnexQueryBuilder
method"where" | "having"
m"where" | "orWhere" | "having"
typeQueryType

Returns: void


splitField

splitField(field: string): [string, string]

Defined in packages/knex/src/query/QueryBuilderHelper.ts:440

Parameters:

NameType
fieldstring

Returns: [string, string]


updateVersionProperty

updateVersionProperty(qb: KnexQueryBuilder, data: Dictionary): void

Defined in packages/knex/src/query/QueryBuilderHelper.ts:464

Parameters:

NameType
qbKnexQueryBuilder
dataDictionary

Returns: void


isCustomExpression

StaticisCustomExpression(field: string): boolean

Defined in packages/knex/src/query/QueryBuilderHelper.ts:481

Parameters:

NameType
fieldstring

Returns: boolean

Last updated on by Martin Adámek