Class ExpressionBuilder

An ExpressionBuilder that is mostly used by the QueryBuilder.
It is used to build a single query expression.
It allows combining multiple expression parts into a single string and provides utilities to generate common expression parts.

Index

Methods

add

  • add(expression: string): void

addFieldExpression

  • addFieldExpression(field: string, operator: string, values: string[], forceEscape?: boolean): void
  • Add a new part to the expression, but specific for field values
    eg @field=(value1,value2,value3).

    Parameters

    • field: string

      The field for which to create an expression (e.g.: @foo).

    • operator: string

      The operator to use e.g.: = (equal) == (strict equal) <> (not equal).

    • values: string[]

      The values to put in the expression.

    • Default value forceEscape: boolean = false

    Returns void

addFieldNotEqualExpression

  • addFieldNotEqualExpression(field: string, values: string[], forceEscape?: boolean): void
  • Add a new part to the expression, but specific for field values
    eg : NOT @field==(value1, value2, value3).

    Parameters

    • field: string

      The field for which to create an expression (e.g.: @foo)

    • values: string[]

      The values to put in the expression.

    • Default value forceEscape: boolean = false

    Returns void

build

  • build(exp?: string): string
  • Builds the expression string by combining all the parts together.

    Parameters

    • Default value exp: string = " "

      expression to join the different parts, default to a space.

    Returns string

fromExpressionBuilder

getParts

  • getParts(): string[]

isEmpty

  • isEmpty(): boolean

remove

  • remove(expression: string): void

Static merge

Static mergeUsingOr

Hierarchy

  • ExpressionBuilder