Module query/ast

AST implementation used by the query parser to convert queries into a tree of nodes.

Class Aggregation

Instance Methods

Instance Properties

Static Properties

Class BetweenCondition

Instance Methods

Instance Properties

Class BooleanValue

Instance Properties

Class Comparison

Instance Methods

Instance Properties

Class Condition

Instance Methods

Instance Properties

Class ConditionList

Instance Methods

Instance Properties

Class DecimalValue

Instance Properties

Class Entity

Instance Methods

Instance Properties

Class ExistsCondition

Instance Methods

Instance Properties

Class Expression

Instance Methods

Instance Properties

Class Factor

Instance Methods

Instance Properties

Class FromClause

Instance Methods

Instance Properties

Class GroupByClause

Instance Methods

Instance Properties

Class HavingClause

Instance Methods

Instance Properties

Class Ident

Instance Methods

Instance Properties

Class InCondition

Instance Methods

Instance Properties

Class InnerJoin

Instance Methods

Instance Properties

Class IntValue

Instance Properties

Class IsNullCondition

Instance Methods

Instance Properties

Class JoinClause

Instance Methods

Instance Properties

Class LikeCondition

Instance Methods

Instance Properties

Class NotCondition

Instance Methods

Instance Properties

Class NullValue

Instance Properties

Class OrderBy

Instance Methods

Instance Properties

Class OrderByClause

Instance Methods

Instance Properties

Class OuterJoin

Instance Methods

Instance Properties

Static Properties

Class ParameterValue

Instance Methods

Instance Properties

Class RangeClause

Instance Methods

Instance Properties

Class Select

Instance Methods

Instance Properties

Class SelectClause

Instance Methods

Instance Properties

Class SelectEntity

Instance Methods

Instance Properties

Class SelectExpression

Instance Methods

Instance Properties

Class StringValue

Instance Properties

Class Summand

Instance Methods

Instance Properties

Class Value

Instance Methods

Class WhereClause

Instance Methods

Instance Properties


Aggregation (type, ident, isDistinct)

Creates a new Aggregation instance

Parameters

String type The type of aggregation
Ident ident The ident
Boolean isDistinct True for distinct aggregations

Returns

A newly created Aggregation instance

Aggregation.COUNT

COUNT aggregation


Aggregation.MAX

MAX aggregation


Aggregation.MIN

MIN aggregation


Aggregation.SUM

SUM aggregation


Aggregation.prototype.accept (visitor)

Calls the method visitAggregation of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Aggregation.prototype.isDistinct

True for distinct aggregation


Aggregation.prototype.type

Contains the type of aggregation


Aggregation.prototype.value

The ident to aggregate


BetweenCondition (start, end, not)

Creates a new BetweenCondition instance

Parameters

Value start The start value
Value end The end value
Boolean not True for "not between" conditions

Returns

A newly created BetweenCondition instance

BetweenCondition.prototype.accept (visitor)

Calls the method visitBetweenCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

BetweenCondition.prototype.end

The end value


BetweenCondition.prototype.isNot

True for "not between" conditions


BetweenCondition.prototype.start

The start value


BooleanValue (value)

Creates a new BooleanValue instance

Parameters

Number value The value

Returns

A newly created BooleanValue instance

See


BooleanValue.prototype.type

The type of this value ("boolean")


BooleanValue.prototype.value

The value of this BooleanValue instance


Comparison (operator, value)

Creates a new Comparison instance

Parameters

String operator The operator
Value value The value

Returns

A newly created Comparison instance

Comparison.prototype.accept (visitor)

Calls the method visitComparison of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Comparison.prototype.operator

The operator


Comparison.prototype.value

The value of this comparison


Condition (left, right)

Creates a new Condition instance

Parameters

Node left The left side of the condition
Node right The right side of the condition

Returns

A newly created Condition instance

Condition.prototype.accept (visitor)

Calls the method visitCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Condition.prototype.left

The left side


Condition.prototype.right

The right side


ConditionList (conditions)

Creates a new ConditionList instance

Parameters

Array conditions An array containing conditions

Returns

A newly created ConditionList instance

ConditionList.prototype.accept (visitor)

Calls the method visitConditionList of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

ConditionList.prototype.conditions

The list of conditions


ConditionList.prototype.length

Contains the number of conditions of this list


DecimalValue (value)

Creates a new DecimalValue instance

Parameters

Number value The value

Returns

A newly created DecimalValue instance

See


DecimalValue.prototype.type

The type of this value ("float")


DecimalValue.prototype.value

The value of this DecimalValue instance


Entity (name, alias)

Creates a new Entity instance

Parameters

String name The name of the entity
String alias The alias of the entity in the query (optional)

Returns

A newly created Entity instance

Entity.prototype.accept (visitor)

Calls the method visitEntity of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Entity.prototype.alias

The alias of the entity in the query


Entity.prototype.name

The name of the entity


Entity.prototype.property

The property of the entity to use ("id")


ExistsCondition (select)

Creates a new ExistsCondition instance

Parameters

Select select The select expression

Returns

A newly created ExistsCondition instance

ExistsCondition.prototype.accept (visitor)

Calls the method visitExistCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

ExistsCondition.prototype.select

The select expression


Expression (andConditions, orConditions)

Creates a new Expression instance

Parameters

Array andConditions An array containing `AND` combined conditions
Array orConditions An array containing `OR` combined conditions

Returns

A newly created Expression instance

Expression.prototype.accept (visitor)

Calls the method visitExpression of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Expression.prototype.andConditions

The list of AND conditions


Expression.prototype.orConditions

The list of OR conditions


Factor (left, operand, right)

Creates a new Factor instance

Parameters

Node left The left side of the factor
String operand The operand
Node right The right side of the factor

Returns

A newly created Factor instance

Factor.prototype.accept (visitor)

Calls the method visitFactor of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Factor.prototype.left

The left side of this factor


Factor.prototype.operand

The operand


Factor.prototype.right

The right side of this factor


FromClause (list)

Creates a new FromClause instance

Parameters

Array list An array containing Entity instances

Returns

A newly created FromClause instance

FromClause.prototype.accept (visitor)

Calls the method visitFromClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

FromClause.prototype.get (idx)

Returns the entity reference at the given index position

Parameters

Number idx The index position

Returns

Entity The entity reference at the given position

FromClause.prototype.length

Contains the number of entity references in this clause


FromClause.prototype.list

The list of references forming the clause


GroupByClause (list)

Creates a new GroupByClause instance

Parameters

Array list The list of expressions forming this clause

Returns

A newly created GroupByClause instance

GroupByClause.prototype.accept (visitor)

Calls the method visitGroupByClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

GroupByClause.prototype.list

The list of expressions


HavingClause (expression)

Creates a new HavingClause instance

Parameters

Expression expression The expression

Returns

A newly created HavingClause instance

HavingClause.prototype.accept (visitor)

Calls the method visitHavingClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

HavingClause.prototype.value

The expression of this clause


Ident (name, property)

Creates a new Ident instance

Parameters

String name The name of the entity
String property The name of the property (optional)

Returns

A newly created Ident instance

Ident.prototype.accept (visitor)

Calls the method visitIdent of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Ident.prototype.entity

The name of the entity


Ident.prototype.property

The property of the entity to use ("id")


InCondition (values, not)

Creates a new InCondition instance

Parameters

Array values An array containing Value instances
Boolean not True for "not in" conditions

Returns

A newly created InCondition instance

InCondition.prototype.accept (visitor)

Calls the method visitInCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

InCondition.prototype.isNot

True for "not in" conditions


InCondition.prototype.values

The values of this InCondition


InnerJoin (entity, predicate)

Creates a new InnerJoin instance

Parameters

Entity entity The entity to join with
Expression predicate The join predicate

Returns

A newly created InnerJoin instance

InnerJoin.prototype.accept (visitor)

Calls the method visitInnerJoin of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

InnerJoin.prototype.entity

The entity to join with


InnerJoin.prototype.predicate

The join predicate


IntValue (value)

Creates a new IntValue instance

Parameters

Number value The value

Returns

A newly created IntValue instance

See


IntValue.prototype.type

The type of this value ("long")


IntValue.prototype.value

The value of this IntValue instance


IsNullCondition (not)

Creates a new IsNullCondition instance

Parameters

Boolean not True or false

Returns

A newly created IsNullCondition instance

IsNullCondition.prototype.accept (visitor)

Calls the method visitIsNullCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

IsNullCondition.prototype.isNot

Contains true for "is not" conditions


JoinClause (list)

Creates a new JoinClause instance

Parameters

Array list An array containing InnerJoin and or OuterJoin instances

Returns

A newly created JoinClause instance

JoinClause.prototype.accept (visitor)

Calls the method visitJoinClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

JoinClause.prototype.get (idx)

Returns the join at the given index position

Parameters

Number idx The index position

Returns

InnerJoin|OuterJoin The join

JoinClause.prototype.length

Contains the number of joins in this clause


JoinClause.prototype.list

The list of joins


LikeCondition (value, not)

Creates a new LikeCondition instance

Parameters

Value value The value of the condition
Boolean not True for "not like" conditions

Returns

A newly created LikeCondition instance

LikeCondition.prototype.accept (visitor)

Calls the method visitLikeCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

LikeCondition.prototype.isNot

True for "not like" conditions


LikeCondition.prototype.value

The value of this condition


NotCondition (value)

Creates a new NotCondition instance

Parameters

Value value The value

Returns

A newly created NotCondition instance

NotCondition.prototype.accept (visitor)

Calls the method visitNotCondition of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

NotCondition.prototype.value

The value


NullValue (value)

Creates a new NullValue instance

Parameters

Number value The value

Returns

A newly created NullValue instance

See


NullValue.prototype.type

The type of this value ("null")


NullValue.prototype.value

The value of this NullValue instance


OrderBy (expression, isReverse, nulls)

Creates a new OrderBy instance

Parameters

Expression expression The expression
Boolean isReverse True if the ordering is descending
Boolean nulls True if nulls should be sorted at the beginning

Returns

A newly created OrderBy instance

OrderBy.prototype.accept (visitor)

Calls the method visitOrderBy of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

OrderBy.prototype.isReverse

True if the ordering is reverse (i.e. descending)


OrderBy.prototype.nulls

True if nulls should be sorted to the beginning


OrderBy.prototype.value

The expression of this clause


OrderByClause (list)

Creates a new OrderByClause instance

Parameters

Array list The list of OrderBy instances forming this clause

Returns

A newly created OrderByClause instance

OrderByClause.prototype.accept (visitor)

Calls the method visitOrderByClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

OrderByClause.prototype.list

The list of OrderBy expressions


OuterJoin (entity, predicate, side)

Creates a new OuterJoin instance

Parameters

Entity entity The entity to join with
Expression predicate The join predicate
String side The side of the outer join

Returns

A newly created OuterJoin instance

OuterJoin.LEFT


OuterJoin.RIGHT


OuterJoin.prototype.accept (visitor)

Calls the method visitOuterJoin of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

OuterJoin.prototype.entity

The entity to join with


OuterJoin.prototype.predicate

The join predicate


OuterJoin.prototype.side

The side of the outer join


ParameterValue (value)

Creates a new ParameterValue instance

Parameters

Number value The value

Returns

A newly created ParameterValue instance

See


ParameterValue.prototype.accept (visitor)

Calls the method visitParameterValue of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

ParameterValue.prototype.type

The type of this value ("parameter")


ParameterValue.prototype.value

The parameter name


RangeClause (offset, limit)

Creates a new RangeClause instance

Parameters

Number offset The offset
Number limit The limit

Returns

A newly created RangeClause instance

RangeClause.prototype.accept (visitor)

Calls the method visitRangeClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

RangeClause.prototype.limit

The limit (defaults to zero, i.e. no limit)


RangeClause.prototype.offset

The offset (defaults to zero)


Select (aliases, select, from, join, where, groupBy, having, orderBy, range, isDistinct)

Creates a new Select instance

Parameters

Array aliases An array containing all aliases within this statement
SelectClause select The select clause
FromClause from The from clause
JoinClause join The join clause
WhereClause where The where clause
GroupByClause groupBy The group by expression
HavingClause having The having clause
OrderByClause orderBy The order by clause
RangeClause range The range clause
Boolean isDistinct True if the select is distinct

Returns

A newly created Select instance

Select.prototype.accept (visitor)

Calls the method visitSelect of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Select.prototype.aliases

The list of aliases of this select statement


Select.prototype.from

Contains the from clause


Select.prototype.groupBy

Contains the group by clause


Select.prototype.having

Contains the having clause


Select.prototype.isDistinct

True for distinct select statements


Select.prototype.join

Contains the join clause


Select.prototype.orderBy

Contains the order by clause


Select.prototype.range

Contains the range clause


Select.prototype.select

Contains the select clause


Select.prototype.where

Contains the where clause


SelectClause (list)

Creates a new SelectClause instance

Parameters

Array list An array containing the select expressions

Returns

A newly created SelectClause instance

SelectClause.prototype.accept (visitor)

Calls the method visitSelectClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

SelectClause.prototype.get (idx)

Returns the select expression at the given index position

Parameters

Number idx The index position

Returns

SelectExpression The select expression

SelectClause.prototype.length

Contains the number of select expressions in this clause


SelectClause.prototype.list

The list of select expressions


SelectEntity (name)

Creates a new SelectEntity instance

Parameters

String name The name of the entity to select

Returns

A newly created SelectExpression instance

SelectEntity.prototype.accept (visitor)

Calls the method visitSelectEntity of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

SelectEntity.prototype.name

Contains the name of the entity to select


SelectEntity.prototype.property

Contains the name of the entity property to select ("id")


SelectExpression (expression, alias)

Creates a new SelectExpression instance

Parameters

Expression expression The expression
String alias Optional alias for the expression

Returns

A newly created SelectExpression instance

SelectExpression.prototype.accept (visitor)

Calls the method visitSelectExpression of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

SelectExpression.prototype.alias

The alias of the expression


SelectExpression.prototype.expression

The expression


StringValue (value)

Creates a new StringValue instance

Parameters

String value The value

Returns

A newly created StringValue instance

See


StringValue.prototype.type

The type of this value ("string")


StringValue.prototype.value

The value of this StringValue instance


Summand (left, operand, right)

Creates a new Summand instance

Parameters

Node left The left side of the summand
String operand The operand
Node right The right side of the summand

Returns

A newly created Summand instance

Summand.prototype.accept (visitor)

Calls the method visitSummand of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

Summand.prototype.left

The left side of this summand


Summand.prototype.operand

The operand


Summand.prototype.right

The right side of this summand


Value ()

Base class for value AST nodes

Returns

A newly created Value instance

See


Value.prototype.accept (visitor)

Calls the method visitValue of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

WhereClause (expression)

Creates a new WhereClause instance

Parameters

Expression expression The expressions forming this clause

Returns

A newly created WhereClause instance

WhereClause.prototype.accept (visitor)

Calls the method visitWhereClause of the visitor passed as argument, passing this instance as argument.

Parameters

Object visitor The visitor

Returns

The value returned by the visitor

WhereClause.prototype.value

The expression