FilterFunction uses ConstantsTrait
Table of Contents
Constants
- ABS : string = 'abs'
- ACOS : string = 'acos'
- APPEND : string = 'append'
- ASIN : string = 'asin'
- ATAN : string = 'atan'
- ATAN2 : string = 'atan2'
- AVG : string = "avg"
- CEIL : string = 'ceil'
- CHAR_LENGTH : string = 'charLength'
- COALESCE : string = 'coalesce'
- CONCAT : string = 'concat'
- CONCAT_SEPARATOR : string = 'concatSeparator'
- CONTAINS : string = 'contains'
- COS : string = 'cos'
- COS_SIMILARITY : string = 'cosSimilarity'
- COUNT : string = 'count'
- COUNT_DISTINCT : string = 'countDistinct'
- DATE_ADD : string = 'dateAdd'
- DATE_COMPARE : string = 'dateCompare'
- DATE_DAY : string = 'dateDay'
- DATE_DAY_OF_WEEK : string = 'dateDayOfWeek'
- DATE_DAY_OF_YEAR : string = 'dateDayOfYear'
- DATE_DAYS_IN_MONTH : string = 'dateDaysInMonth'
- DATE_DIFF : string = 'dateDiff'
- DATE_FORMAT : string = 'dateFormat'
- DATE_HOUR : string = 'dateHour'
- DATE_ISO_8601 : string = 'dateISO8601'
- DATE_ISO_WEEK : string = 'dateIsoWeek'
- DATE_ISO_WEEK_YEAR : string = 'dateIsoWeekYear'
- DATE_LEAP_YEAR : string = 'dateLeapYear'
- DATE_LOCAL_TO_UTC : string = 'dateLocalToUTC'
- DATE_MILLISECOND : string = 'dateMillisecond'
- DATE_MINUTE : string = 'dateMinute'
- DATE_MONTH : string = 'dateMonth'
- DATE_QUARTER : string = 'dateQuarter'
- DATE_SECOND : string = 'dateSecond'
- DATE_SUBTRACT : string = 'dateSubtract'
- DATE_TIMESTAMP : string = 'dateTimeStamp'
- DATE_TIMEZONE : string = 'dateTimezone'
- DATE_TRUNC : string = 'dateTrunc'
- DATE_UTC_TO_LOCAL : string = 'dateUTCToLocal'
- DATE_YEAR : string = 'dateYear'
- DEGREES : string = 'deg'
- ENCODE_URI : string = 'encodeURIComponent'
- EXP : string = 'exp'
- EXP2 : string = 'exp2'
- FIND_FIRST : string = 'findFirst'
- FIND_LAST : string = 'findLast'
- FIRST : string = 'first'
- FLOOR : string = 'floor'
- FNV64 : string = 'fnv64'
- IPV4_FROM_NUMBER : string = 'ipv4FromNumber'
- IPV4_TO_NUMBER : string = 'ipv4ToNumber'
- IS_IPV4 : string = 'isIPV4'
- JSON_PARSE : string = 'jsonParse'
- JSON_STRINGIFY : string = 'jsonStringify'
- LAST : string = 'last'
- LEFT : string = 'left'
- LENGTH : string = 'length'
- LEVENSHTEIN : string = 'levenshtein'
- LIKE : string = 'like'
- LOG : string = 'log'
- LOG10 : string = 'log10'
- LOG2 : string = 'log2'
- LOWER : string = 'lower'
- LTRIM : string = 'ltrim'
- MAX : string = "max"
- MD5 : string = 'md5'
- MEDIAN : string = "median"
- MIN : string = "min"
- NOT_NULL : string = 'notNull'
- NTH : string = 'nth'
- PERCENTILE : string = "percentile"
- PLUCK : string = 'pluck'
- POP : string = 'pop'
- POSITION : string = 'position'
- POW : string = 'pow'
- PRODUCT : string = "product"
- PUSH : string = 'push'
- RADIANS : string = 'rad'
- RANDOM_TOKEN : string = 'randomToken'
- REMOVE : string = 'remove'
- REMOVES : string = 'removes'
- REVERSE : string = 'reverse'
- RIGHT : string = 'right'
- ROUND : string = 'rnd'
- RTRIM : string = 'rtrim'
- SHA1 : string = 'sha1'
- SHA256 : string = 'sha256'
- SHA512 : string = 'sha512'
- SHIFT : string = 'shift'
- SIN : string = 'sin'
- SLICE : string = 'slice'
- SORTED : string = 'sorted'
- SORTED_UNIQUE : string = 'sortedUnique'
- SOUNDEX : string = 'soundex'
- SPLIT : string = 'split'
- SQRT : string = 'sqrt'
- STARTS_WITH : string = 'startsWith'
- SUBSTRING : string = 'substring'
- SUM : string = "sum"
- TAN : string = 'tan'
- TO_BASE64 : string = 'toBase64'
- TO_CHAR : string = 'toChar'
- TO_HEX : string = 'toHex'
- TOKENS : string = 'tokens'
- TOMORROW : string = 'tomorrow'
- TRIM : string = 'trim'
- UNIQUE : string = 'unique'
- UNSHIFT : string = 'unshift'
- UPPER : string = 'upper'
- UUID : string = 'uuid'
- YESTERDAY : string = 'yesterday'
- BOOLEAN_FUNCTIONS : array<string|int, mixed> = [self::CONTAINS, self::DATE_LEAP_YEAR, self::IS...
- Functions that return boolean values.
- UNBOUND_FUNCTIONS : array<string|int, mixed> = [self::COALESCE, self::CONCAT_SEPARATOR, self::...
- The codes whose string parameters are **not** bound, even when a binder is supplied — each because it already renders its parameter safely, and would quote or re-read a `@name` token into something meaningless:
Methods
- apply() : string
- Apply a function to a key with optional parameters.
- missingParameter() : ValidationException
- Builds the refusal of an arm whose operand is required.
- unknownFunction() : ValidationException
- Builds the refusal of a name this catalogue does not carry.
Constants
ABS
public
string
ABS
= 'abs'
ACOS
public
string
ACOS
= 'acos'
APPEND
public
string
APPEND
= 'append'
ASIN
public
string
ASIN
= 'asin'
ATAN
public
string
ATAN
= 'atan'
ATAN2
public
string
ATAN2
= 'atan2'
AVG
public
string
AVG
= "avg"
CEIL
public
string
CEIL
= 'ceil'
CHAR_LENGTH
public
string
CHAR_LENGTH
= 'charLength'
COALESCE
public
string
COALESCE
= 'coalesce'
CONCAT
public
string
CONCAT
= 'concat'
CONCAT_SEPARATOR
public
string
CONCAT_SEPARATOR
= 'concatSeparator'
CONTAINS
public
string
CONTAINS
= 'contains'
COS
public
string
COS
= 'cos'
COS_SIMILARITY
public
string
COS_SIMILARITY
= 'cosSimilarity'
COUNT
public
string
COUNT
= 'count'
COUNT_DISTINCT
public
string
COUNT_DISTINCT
= 'countDistinct'
DATE_ADD
public
string
DATE_ADD
= 'dateAdd'
DATE_COMPARE
public
string
DATE_COMPARE
= 'dateCompare'
DATE_DAY
public
string
DATE_DAY
= 'dateDay'
DATE_DAY_OF_WEEK
public
string
DATE_DAY_OF_WEEK
= 'dateDayOfWeek'
DATE_DAY_OF_YEAR
public
string
DATE_DAY_OF_YEAR
= 'dateDayOfYear'
DATE_DAYS_IN_MONTH
public
string
DATE_DAYS_IN_MONTH
= 'dateDaysInMonth'
DATE_DIFF
public
string
DATE_DIFF
= 'dateDiff'
DATE_FORMAT
public
string
DATE_FORMAT
= 'dateFormat'
DATE_HOUR
public
string
DATE_HOUR
= 'dateHour'
DATE_ISO_8601
public
string
DATE_ISO_8601
= 'dateISO8601'
DATE_ISO_WEEK
public
string
DATE_ISO_WEEK
= 'dateIsoWeek'
DATE_ISO_WEEK_YEAR
public
string
DATE_ISO_WEEK_YEAR
= 'dateIsoWeekYear'
DATE_LEAP_YEAR
public
string
DATE_LEAP_YEAR
= 'dateLeapYear'
DATE_LOCAL_TO_UTC
public
string
DATE_LOCAL_TO_UTC
= 'dateLocalToUTC'
DATE_MILLISECOND
public
string
DATE_MILLISECOND
= 'dateMillisecond'
DATE_MINUTE
public
string
DATE_MINUTE
= 'dateMinute'
DATE_MONTH
public
string
DATE_MONTH
= 'dateMonth'
DATE_QUARTER
public
string
DATE_QUARTER
= 'dateQuarter'
DATE_SECOND
public
string
DATE_SECOND
= 'dateSecond'
DATE_SUBTRACT
public
string
DATE_SUBTRACT
= 'dateSubtract'
DATE_TIMESTAMP
public
string
DATE_TIMESTAMP
= 'dateTimeStamp'
DATE_TIMEZONE
public
string
DATE_TIMEZONE
= 'dateTimezone'
DATE_TRUNC
public
string
DATE_TRUNC
= 'dateTrunc'
DATE_UTC_TO_LOCAL
public
string
DATE_UTC_TO_LOCAL
= 'dateUTCToLocal'
DATE_YEAR
public
string
DATE_YEAR
= 'dateYear'
DEGREES
public
string
DEGREES
= 'deg'
ENCODE_URI
public
string
ENCODE_URI
= 'encodeURIComponent'
EXP
public
string
EXP
= 'exp'
EXP2
public
string
EXP2
= 'exp2'
FIND_FIRST
public
string
FIND_FIRST
= 'findFirst'
FIND_LAST
public
string
FIND_LAST
= 'findLast'
FIRST
public
string
FIRST
= 'first'
FLOOR
public
string
FLOOR
= 'floor'
FNV64
public
string
FNV64
= 'fnv64'
IPV4_FROM_NUMBER
public
string
IPV4_FROM_NUMBER
= 'ipv4FromNumber'
IPV4_TO_NUMBER
public
string
IPV4_TO_NUMBER
= 'ipv4ToNumber'
IS_IPV4
public
string
IS_IPV4
= 'isIPV4'
JSON_PARSE
public
string
JSON_PARSE
= 'jsonParse'
JSON_STRINGIFY
public
string
JSON_STRINGIFY
= 'jsonStringify'
LAST
public
string
LAST
= 'last'
LEFT
public
string
LEFT
= 'left'
LENGTH
public
string
LENGTH
= 'length'
LEVENSHTEIN
public
string
LEVENSHTEIN
= 'levenshtein'
LIKE
public
string
LIKE
= 'like'
LOG
public
string
LOG
= 'log'
LOG10
public
string
LOG10
= 'log10'
LOG2
public
string
LOG2
= 'log2'
LOWER
public
string
LOWER
= 'lower'
LTRIM
public
string
LTRIM
= 'ltrim'
MAX
public
string
MAX
= "max"
MD5
public
string
MD5
= 'md5'
MEDIAN
public
string
MEDIAN
= "median"
MIN
public
string
MIN
= "min"
NOT_NULL
public
string
NOT_NULL
= 'notNull'
NTH
public
string
NTH
= 'nth'
PERCENTILE
public
string
PERCENTILE
= "percentile"
PLUCK
public
string
PLUCK
= 'pluck'
POP
public
string
POP
= 'pop'
POSITION
public
string
POSITION
= 'position'
POW
public
string
POW
= 'pow'
PRODUCT
public
string
PRODUCT
= "product"
PUSH
public
string
PUSH
= 'push'
RADIANS
public
string
RADIANS
= 'rad'
RANDOM_TOKEN
public
string
RANDOM_TOKEN
= 'randomToken'
REMOVE
public
string
REMOVE
= 'remove'
REMOVES
public
string
REMOVES
= 'removes'
REVERSE
public
string
REVERSE
= 'reverse'
RIGHT
public
string
RIGHT
= 'right'
ROUND
public
string
ROUND
= 'rnd'
RTRIM
public
string
RTRIM
= 'rtrim'
SHA1
public
string
SHA1
= 'sha1'
SHA256
public
string
SHA256
= 'sha256'
SHA512
public
string
SHA512
= 'sha512'
SHIFT
public
string
SHIFT
= 'shift'
SIN
public
string
SIN
= 'sin'
SLICE
public
string
SLICE
= 'slice'
SORTED
public
string
SORTED
= 'sorted'
SORTED_UNIQUE
public
string
SORTED_UNIQUE
= 'sortedUnique'
SOUNDEX
public
string
SOUNDEX
= 'soundex'
SPLIT
public
string
SPLIT
= 'split'
SQRT
public
string
SQRT
= 'sqrt'
STARTS_WITH
public
string
STARTS_WITH
= 'startsWith'
SUBSTRING
public
string
SUBSTRING
= 'substring'
SUM
public
string
SUM
= "sum"
TAN
public
string
TAN
= 'tan'
TO_BASE64
public
string
TO_BASE64
= 'toBase64'
TO_CHAR
public
string
TO_CHAR
= 'toChar'
TO_HEX
public
string
TO_HEX
= 'toHex'
TOKENS
public
string
TOKENS
= 'tokens'
TOMORROW
public
string
TOMORROW
= 'tomorrow'
TRIM
public
string
TRIM
= 'trim'
UNIQUE
public
string
UNIQUE
= 'unique'
UNSHIFT
public
string
UNSHIFT
= 'unshift'
UPPER
public
string
UPPER
= 'upper'
UUID
public
string
UUID
= 'uuid'
YESTERDAY
public
string
YESTERDAY
= 'yesterday'
BOOLEAN_FUNCTIONS
Functions that return boolean values.
private
array<string|int, mixed>
BOOLEAN_FUNCTIONS
= [self::CONTAINS, self::DATE_LEAP_YEAR, self::IS_IPV4, self::LIKE, self::STARTS_WITH]
UNBOUND_FUNCTIONS
The codes whose string parameters are **not** bound, even when a binder is supplied — each because it already renders its parameter safely, and would quote or re-read a `@name` token into something meaningless:
private
array<string|int, mixed>
UNBOUND_FUNCTIONS
= [self::COALESCE, self::CONCAT_SEPARATOR, self::CONTAINS, self::NOT_NULL, self::PLUCK]
contains/concatSeparator— routed through aqlValue(), which quotes and escapes ('mo\') || true || (\'nth'). A bound token would come back out as the literal string'@q_123456'.coalesce/notNull— already inlined as strict AQL literals viajson_encode, the one arm hardened when the option was introduced.pluck— its parameter is an attribute name, not a value: AQL has no bind parameter for that position, and assertAttributeName() guards it.
Methods
apply()
Apply a function to a key with optional parameters.
public
static apply(string $funcName, string $key[, array<string|int, mixed> $params = [] ][, array<string|int, mixed> $init = [] ]) : string
This method acts as a dispatcher that calls the appropriate AQL function wrapper based on the function name. It supports string, number, and array functions.
Parameters
- $funcName : string
-
Function name (e.g., "trim", "lower", "abs", "avg")
- $key : string
-
Current key expression (e.g., "doc.name")
- $params : array<string|int, mixed> = []
-
Additional parameters for the function
- $init : array<string|int, mixed> = []
Tags
Return values
string —The key wrapped in the AQL function
missingParameter()
Builds the refusal of an arm whose operand is required.
private
static missingParameter(string $funcName, string $operand) : ValidationException
Three entries of the catalogue take a second operand that has no
meaningful default: AQL has no "position of nothing", no "similarity with
nothing" and no "distance to nothing" — each of those functions is binary.
Called bare, they used to fail in two unhelpful ways: a TypeError for a
null handed to a non-nullable parameter, which is a fatal no caller
declares or catches, or a silent no-op returning the key untouched, which
quietly changes what the filter means — POSITION(doc.tags, "x") == true
becomes doc.tags == true, a well-formed answer that matches nothing.
A ValidationException is the refusal apply() already declares, and
it names both the arm and the operand it wanted.
Parameters
- $funcName : string
- $operand : string
Return values
ValidationExceptionunknownFunction()
Builds the refusal of a name this catalogue does not carry.
private
static unknownFunction(string $funcName) : ValidationException
The arm used to return the key untouched, on the reading that an unknown
name asks for nothing. It asks for something the engine cannot deliver,
which is not the same: DATE_ISOWEEK(doc.startDate) == @week silently
became doc.startDate == @week, and no date is ever equal to 34 —
a well-formed query, in 200, matching nothing. A caller mistyping
dateIsoWeek therefore read the collection as empty.
A function name is a closed identifier: it belongs to the catalogue or it
does not, so there is no ambiguity to preserve and nothing to keep for
compatibility. alterExpression() refuses
before reaching here — it knows who wrote the chain and answers accordingly.
This arm is the backstop for the callers that reach apply() directly.
Parameters
- $funcName : string