Version: 4.3

Class: CriteriaNode

Helper for working with deeply nested where/orderBy/having criteria. Uses composite pattern to build tree from the payload. Auto-joins relations and converts payload from { books: { publisher: { name: '...' } } } to { 'publisher_alias.name': '...' }

Hierarchy

Constructors

constructor

+ new CriteriaNode(metadata: MetadataStorage, entityName: string, parent?: ICriteriaNode, key?: string, validate?: boolean): CriteriaNode

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

Parameters:

NameTypeDefault value
metadataMetadataStorage-
entityNamestring-
parent?ICriteriaNode-
key?string-
validatebooleantrue

Returns: CriteriaNode

Properties

entityName

Readonly entityName: string

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


key

Optional Readonly key: string

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


metadata

Protected Readonly metadata: MetadataStorage

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


parent

Optional Readonly parent: ICriteriaNode

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


payload

payload: any

Defined in packages/knex/src/query/CriteriaNode.ts:11


prop

Optional prop: EntityProperty

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

Methods

[inspect.custom]

[inspect.custom](): string

Defined in packages/knex/src/query/CriteriaNode.ts:119

Returns: string


getPath

getPath(): string

Defined in packages/knex/src/query/CriteriaNode.ts:78

Returns: string


getPivotPath

getPivotPath(path: string): string

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

Parameters:

NameType
pathstring

Returns: string


isPivotJoin

PrivateisPivotJoin(): boolean

Defined in packages/knex/src/query/CriteriaNode.ts:103

Returns: boolean


process

process<T>(qb: IQueryBuilder<T>, alias?: string): any

Defined in packages/knex/src/query/CriteriaNode.ts:32

Type parameters:

Name
T

Parameters:

NameType
qbIQueryBuilder<T>
alias?string

Returns: any


renameFieldToPK

renameFieldToPK<T>(qb: IQueryBuilder<T>): string

Defined in packages/knex/src/query/CriteriaNode.ts:64

Type parameters:

Name
T

Parameters:

NameType
qbIQueryBuilder<T>

Returns: string


shouldInline

shouldInline(payload: any): boolean

Defined in packages/knex/src/query/CriteriaNode.ts:36

Parameters:

NameType
payloadany

Returns: boolean


shouldRename

shouldRename(payload: any): boolean

Defined in packages/knex/src/query/CriteriaNode.ts:44

Parameters:

NameType
payloadany

Returns: boolean


willAutoJoin

willAutoJoin<T>(qb: IQueryBuilder<T>, alias?: string): boolean

Defined in packages/knex/src/query/CriteriaNode.ts:40

Type parameters:

Name
T

Parameters:

NameType
qbIQueryBuilder<T>
alias?string

Returns: boolean


isCustomExpression

StaticisCustomExpression(field: string): boolean

Defined in packages/knex/src/query/CriteriaNode.ts:123

Parameters:

NameType
fieldstring

Returns: boolean

Last updated on by Martin Adámek