Expression
in package
Filter expression, which can be applied to most commands, to control which records are affected by the command.
Table of Contents
Methods
- and() : Expression
- Create "and" (&&) operator that applies to a variable number of expressions.
- binExists() : Expression
- Create function that returns if bin of specified name exists.
- binType() : Expression
- ExpBinType creates a function that returns bin's integer particle type. Valid values are:
- blobBin() : Expression
- Create blob bin expression.
- blobVal() : Expression
- Creates Blob bin value
- boolVal() : Expression
- Creates a Boolean value
- cond() : Expression
- -------------------------------------------------- Variables -------------------------------------------------- Conditionally select an expression from a variable number of expression pairs followed by default expression action.
- def() : Expression
- Assign variable to an expression that can be accessed later.
- deviceSize() : Expression
- Create function that returns record size on disk.
- digestModulo() : Expression
- Create function that returns record digest modulo as integer.
- eq() : Expression
- Create equal (==) expression.
- expLet() : Expression
- Define variables and expressions in scope.
- floatBin() : Expression
- Create 64 bit float bin expression.
- floatVal() : Expression
- Creates 64 bit float bin value
- ge() : Expression
- Create greater than or equal (>=) operation.
- geoBin() : Expression
- Create geo bin expression.
- geoCompare() : Expression
- Create compare geospatial operation.
- geoVal() : Expression
- Create geospatial json string value.
- gt() : Expression
- Create greater than (>) operation.
- hllBin() : Expression
- Create a HLL bin expression
- infinity() : Expression
- Create a Infinity PHPValue
- intAnd() : Expression
- Create integer "and" (&) operator that is applied to two or more integers.
- intArshift() : Expression
- Create integer "arithmetic right shift" (>>) operator.
- intBin() : Expression
- Create 64 bit int bin expression.
- intCount() : Expression
- Create expression that returns count of integer bits that are set to 1.
- intLscan() : Expression
- Create expression that scans integer bits from left (most significant bit) to right (least significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0.
- intLshift() : Expression
- Create integer "left shift" (<<) operator.
- intNot() : Expression
- Create integer "not" (~) operator.
- intOr() : Expression
- Create integer "or" (|) operator that is applied to two or more integers.
- intRscan() : Expression
- Create expression that scans integer bits from right (least significant bit) to left (most significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0.
- intRshift() : Expression
- Create integer "logical right shift" (>>>) operator.
- intVal() : Expression
- Creates 64 bit integer value
- intXor() : Expression
- Create integer "xor" (^) operator that is applied to two or more integers.
- isTombstone() : Expression
- Create expression that returns if record has been deleted and is still in tombstone state.
- key() : Expression
- Create a record key expression of specified type.
- keyExists() : Expression
- Create function that returns if the primary key is stored in the record meta data as a boolean expression. This would occur when `send_key` is true on record write.
- lastUpdate() : Expression
- Create function that returns record last update time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
- le() : Expression
- Create less than or equals (<=) operation.
- listBin() : Expression
- Create list bin expression.
- listVal() : Expression
- Create List bin PHPValue Not Supported in pre-alpha release
- lt() : Expression
- Create less than (<) operation.
- mapBin() : Expression
- Create map bin expression.
- mapVal() : Expression|null
- Create Map bin PHPValue Value must be a map
- max() : Expression
- Create expression that returns the maximum value in a variable number of expressions.
- memorySize() : Expression
- Create expression that returns record size in memory. If server storage-engine is not memory nor data-in-memory, then zero is returned. This expression usually evaluates quickly because record meta data is cached in memory.
- min() : Expression
- Create expression that returns the minimum value in a variable number of expressions.
- ne() : Expression
- Create not equal (!=) expression
- new() : Expression
- nil() : Expression
- Create a Nil PHPValue
- not() : Expression
- Create "not" operator expression.
- numAbs() : Expression
- Create operator that returns absolute value of a number.
- numAdd() : Expression
- Create "add" (+) operator that applies to a variable number of expressions.
- numCeil() : Expression
- Create expression that rounds a floating point number up to the closest integer value.
- numDiv() : Expression
- Create "divide" (/) operator that applies to a variable number of expressions.
- numFloor() : Expression
- Create expression that rounds a floating point number down to the closest integer value.
- numLog() : Expression
- Create "log" operator for logarithm of "num" with base "base".
- numMod() : Expression
- Create "modulo" (%) operator that determines the remainder of "numerator" divided by "denominator". All arguments must resolve to integers.
- numMul() : Expression
- Create "multiply" (*) operator that applies to a variable number of expressions.
- numPow() : Expression
- Create "power" operator that raises a "base" to the "exponent" power.
- numSub() : Expression
- Create "subtract" (-) operator that applies to a variable number of expressions.
- or() : Expression
- Create "or" (||) operator that applies to a variable number of expressions.
- regexCompare() : Expression
- Create function like regular expression string operation.
- setName() : Expression
- Create function that returns record set name string.
- sinceUpdate() : Expression
- Create expression that returns milliseconds since the record was last updated.
- stringBin() : Expression
- Create string bin expression.
- stringVal() : Expression
- Creates String bin value
- toFloat() : Expression
- Create expression that converts a float to an integer.
- toInt() : Expression
- Create expression that converts an integer to a float.
- ttl() : Expression
- Create function that returns record expiration time (time to live) in integer seconds.
- unknown() : Expression
- Create unknown value. Used to intentionally fail an expression.
- var() : Expression
- Retrieve expression value from a variable.
- voidTime() : Expression
- Create function that returns record expiration time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
- wildcard() : Expression
- Create a WildCard PHPValue
- xor() : Expression
- Create "xor" (^) operator that applies to a variable number of expressions.
Methods
and()
Create "and" (&&) operator that applies to a variable number of expressions.
public
static and(array<string|int, mixed> $exps) : Expression
/// (a > 5 || a == 0) && b < 3
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionbinExists()
Create function that returns if bin of specified name exists.
public
static binExists(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionbinType()
ExpBinType creates a function that returns bin's integer particle type. Valid values are:
public
static binType(string $name) : Expression
NULL = 0 INTEGER = 1 FLOAT = 2 STRING = 3 BLOB = 4 DIGEST = 6 BOOL = 17 HLL = 18 MAP = 19 LIST = 20 LDT = 21 GEOJSON = 23
Parameters
- $name : string
Return values
ExpressionblobBin()
Create blob bin expression.
public
static blobBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionblobVal()
Creates Blob bin value
public
static blobVal(array<string|int, mixed> $val) : Expression
Parameters
- $val : array<string|int, mixed>
Return values
ExpressionboolVal()
Creates a Boolean value
public
static boolVal(bool $val) : Expression
Parameters
- $val : bool
Return values
Expressioncond()
-------------------------------------------------- Variables -------------------------------------------------- Conditionally select an expression from a variable number of expression pairs followed by default expression action.
public
static cond(array<string|int, mixed> $exps) : Expression
Requires server version 5.6.0+.
/// Args Format: bool exp1, action exp1, bool exp2, action exp2, ..., action-default
/// Apply operator based on type.
Parameters
- $exps : array<string|int, mixed>
Return values
Expressiondef()
Assign variable to an expression that can be accessed later.
public
static def(string $name, Expression $value) : Expression
Requires server version 5.6.0+.
/// 5 < a < 10
Parameters
- $name : string
- $value : Expression
Return values
ExpressiondeviceSize()
Create function that returns record size on disk.
public
static deviceSize() : Expression
If server storage-engine is memory, then zero is returned.
This expression should only be used for server versions less than 7.0. Use record_size for server version 7.0+.
Return values
ExpressiondigestModulo()
Create function that returns record digest modulo as integer.
public
static digestModulo(int $modulo) : Expression
Parameters
- $modulo : int
Return values
Expressioneq()
Create equal (==) expression.
public
static eq(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressionexpLet()
Define variables and expressions in scope.
public
static expLet(array<string|int, mixed> $exps) : Expression
Requires server version 5.6.0+.
/// 5 < a < 10
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionfloatBin()
Create 64 bit float bin expression.
public
static floatBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionfloatVal()
Creates 64 bit float bin value
public
static floatVal(float $val) : Expression
Parameters
- $val : float
Return values
Expressionge()
Create greater than or equal (>=) operation.
public
static ge(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressiongeoBin()
Create geo bin expression.
public
static geoBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressiongeoCompare()
Create compare geospatial operation.
public
static geoCompare(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressiongeoVal()
Create geospatial json string value.
public
static geoVal(string $val) : Expression
Parameters
- $val : string
Return values
Expressiongt()
Create greater than (>) operation.
public
static gt(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressionhllBin()
Create a HLL bin expression
public
static hllBin(string $name) : Expression
Parameters
- $name : string
Return values
Expressioninfinity()
Create a Infinity PHPValue
public
static infinity() : Expression
Return values
ExpressionintAnd()
Create integer "and" (&) operator that is applied to two or more integers.
public
static intAnd(array<string|int, mixed> $exps) : Expression
All arguments must resolve to integers. Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionintArshift()
Create integer "arithmetic right shift" (>>) operator.
public
static intArshift(Expression $value, Expression $shift) : Expression
The sign bit is preserved and not shifted. Requires server version 5.6.0+.
Parameters
- $value : Expression
- $shift : Expression
Return values
ExpressionintBin()
Create 64 bit int bin expression.
public
static intBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionintCount()
Create expression that returns count of integer bits that are set to 1.
public
static intCount(Expression $exp) : Expression
Requires server version 5.6.0+
Parameters
- $exp : Expression
Return values
ExpressionintLscan()
Create expression that scans integer bits from left (most significant bit) to right (least significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0.
public
static intLscan(Expression $value, Expression $search) : Expression
Requires server version 5.6.0+.
Parameters
- $value : Expression
- $search : Expression
Return values
ExpressionintLshift()
Create integer "left shift" (<<) operator.
public
static intLshift(Expression $value, Expression $shift) : Expression
Requires server version 5.6.0+.
Parameters
- $value : Expression
- $shift : Expression
Return values
ExpressionintNot()
Create integer "not" (~) operator.
public
static intNot(Expression $exp) : Expression
Requires server version 5.6.0+.
Parameters
- $exp : Expression
Return values
ExpressionintOr()
Create integer "or" (|) operator that is applied to two or more integers.
public
static intOr(array<string|int, mixed> $exps) : Expression
All arguments must resolve to integers. Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionintRscan()
Create expression that scans integer bits from right (least significant bit) to left (most significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0.
public
static intRscan(Expression $value, Expression $search) : Expression
Requires server version 5.6.0+.
Parameters
- $value : Expression
- $search : Expression
Return values
ExpressionintRshift()
Create integer "logical right shift" (>>>) operator.
public
static intRshift(Expression $value, Expression $shift) : Expression
Requires server version 5.6.0+.
Parameters
- $value : Expression
- $shift : Expression
Return values
ExpressionintVal()
Creates 64 bit integer value
public
static intVal(int $val) : Expression
Parameters
- $val : int
Return values
ExpressionintXor()
Create integer "xor" (^) operator that is applied to two or more integers.
public
static intXor(array<string|int, mixed> $exps) : Expression
All arguments must resolve to integers. Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionisTombstone()
Create expression that returns if record has been deleted and is still in tombstone state.
public
static isTombstone() : Expression
This expression usually evaluates quickly because record meta data is cached in memory.
Return values
Expressionkey()
Create a record key expression of specified type.
public
static key(mixed $exp_type) : Expression
Parameters
- $exp_type : mixed
Return values
ExpressionkeyExists()
Create function that returns if the primary key is stored in the record meta data as a boolean expression. This would occur when `send_key` is true on record write.
public
static keyExists() : Expression
Return values
ExpressionlastUpdate()
Create function that returns record last update time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
public
static lastUpdate() : Expression
Return values
Expressionle()
Create less than or equals (<=) operation.
public
static le(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressionlistBin()
Create list bin expression.
public
static listBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionlistVal()
Create List bin PHPValue Not Supported in pre-alpha release
public
static listVal(array<string|int, mixed> $val) : Expression
Parameters
- $val : array<string|int, mixed>
Return values
Expressionlt()
Create less than (<) operation.
public
static lt(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
ExpressionmapBin()
Create map bin expression.
public
static mapBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionmapVal()
Create Map bin PHPValue Value must be a map
public
static mapVal(mixed $val) : Expression|null
Parameters
- $val : mixed
Return values
Expression|nullmax()
Create expression that returns the maximum value in a variable number of expressions.
public
static max(array<string|int, mixed> $exps) : Expression
All arguments must be the same type (integer or float). Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionmemorySize()
Create expression that returns record size in memory. If server storage-engine is not memory nor data-in-memory, then zero is returned. This expression usually evaluates quickly because record meta data is cached in memory.
public
static memorySize() : Expression
Requires server version between 5.3 inclusive and 7.0 exclusive. Use record_size for server version 7.0+.
Return values
Expressionmin()
Create expression that returns the minimum value in a variable number of expressions.
public
static min(array<string|int, mixed> $exps) : Expression
All arguments must be the same type (integer or float). Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
Expressionne()
Create not equal (!=) expression
public
static ne(Expression $left, Expression $right) : Expression
Parameters
- $left : Expression
- $right : Expression
Return values
Expressionnew()
public
static new(int|null $cmd, mixed $val, Expression|null $bin, int|null $flags, mixed $module, array<string|int, mixed> $exps) : Expression
Parameters
- $cmd : int|null
- $val : mixed
- $bin : Expression|null
- $flags : int|null
- $module : mixed
- $exps : array<string|int, mixed>
Return values
Expressionnil()
Create a Nil PHPValue
public
static nil() : Expression
Return values
Expressionnot()
Create "not" operator expression.
public
static not(Expression $exp) : Expression
Parameters
- $exp : Expression
Return values
ExpressionnumAbs()
Create operator that returns absolute value of a number.
public
static numAbs(Expression $value) : Expression
All arguments must resolve to integer or float. Requires server version 5.6.0+.
Parameters
- $value : Expression
Return values
ExpressionnumAdd()
Create "add" (+) operator that applies to a variable number of expressions.
public
static numAdd(array<string|int, mixed> $exps) : Expression
Return sum of all FilterExpressions
given. All arguments must resolve to the same type (integer or float).
Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionnumCeil()
Create expression that rounds a floating point number up to the closest integer value.
public
static numCeil(Expression $num) : Expression
The return type is float. Requires server version 5.6.0+.
Parameters
- $num : Expression
Return values
ExpressionnumDiv()
Create "divide" (/) operator that applies to a variable number of expressions.
public
static numDiv(array<string|int, mixed> $exps) : Expression
If there is only one FilterExpressions
, returns the reciprocal for that FilterExpressions
.
Otherwise, return the first FilterExpressions
divided by the product of the rest.
All FilterExpressions
must resolve to the same type (integer or float).
Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionnumFloor()
Create expression that rounds a floating point number down to the closest integer value.
public
static numFloor(Expression $num) : Expression
The return type is float. Requires server version 5.6.0+.
Parameters
- $num : Expression
Return values
ExpressionnumLog()
Create "log" operator for logarithm of "num" with base "base".
public
static numLog(Expression $num, Expression $base) : Expression
All arguments must resolve to floats. Requires server version 5.6.0+.
Parameters
- $num : Expression
- $base : Expression
Return values
ExpressionnumMod()
Create "modulo" (%) operator that determines the remainder of "numerator" divided by "denominator". All arguments must resolve to integers.
public
static numMod(Expression $numerator, Expression $denominator) : Expression
Requires server version 5.6.0+.
Parameters
- $numerator : Expression
- $denominator : Expression
Return values
ExpressionnumMul()
Create "multiply" (*) operator that applies to a variable number of expressions.
public
static numMul(array<string|int, mixed> $exps) : Expression
Return the product of all FilterExpressions
. If only one FilterExpressions
is supplied, return
that FilterExpressions
. All FilterExpressions
must resolve to the same type (integer or float).
Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionnumPow()
Create "power" operator that raises a "base" to the "exponent" power.
public
static numPow(Expression $base, Expression $exponent) : Expression
All arguments must resolve to floats. Requires server version 5.6.0+.
Parameters
- $base : Expression
- $exponent : Expression
Return values
ExpressionnumSub()
Create "subtract" (-) operator that applies to a variable number of expressions.
public
static numSub(array<string|int, mixed> $exps) : Expression
If only one FilterExpressions
is provided, return the negation of that argument.
Otherwise, return the sum of the 2nd to Nth FilterExpressions
subtracted from the 1st
FilterExpressions
. All FilterExpressions
must resolve to the same type (integer or float).
Requires server version 5.6.0+.
Parameters
- $exps : array<string|int, mixed>
Return values
Expressionor()
Create "or" (||) operator that applies to a variable number of expressions.
public
static or(array<string|int, mixed> $exps) : Expression
Parameters
- $exps : array<string|int, mixed>
Return values
ExpressionregexCompare()
Create function like regular expression string operation.
public
static regexCompare(string $regex, int $flags, Expression $bin) : Expression
Parameters
- $regex : string
- $flags : int
- $bin : Expression
Return values
ExpressionsetName()
Create function that returns record set name string.
public
static setName() : Expression
Return values
ExpressionsinceUpdate()
Create expression that returns milliseconds since the record was last updated.
public
static sinceUpdate() : Expression
This expression usually evaluates quickly because record meta data is cached in memory.
Return values
ExpressionstringBin()
Create string bin expression.
public
static stringBin(string $name) : Expression
Parameters
- $name : string
Return values
ExpressionstringVal()
Creates String bin value
public
static stringVal(string $val) : Expression
Parameters
- $val : string
Return values
ExpressiontoFloat()
Create expression that converts a float to an integer.
public
static toFloat(Expression $num) : Expression
Requires server version 5.6.0+.
Parameters
- $num : Expression
Return values
ExpressiontoInt()
Create expression that converts an integer to a float.
public
static toInt(Expression $num) : Expression
Requires server version 5.6.0+.
Parameters
- $num : Expression
Return values
Expressionttl()
Create function that returns record expiration time (time to live) in integer seconds.
public
static ttl() : Expression
Return values
Expressionunknown()
Create unknown value. Used to intentionally fail an expression.
public
static unknown() : Expression
The failure can be ignored with ExpWriteFlags
EVAL_NO_FAIL
or ExpReadFlags
EVAL_NO_FAIL
.
Requires server version 5.6.0+.
Return values
Expressionvar()
Retrieve expression value from a variable.
public
static var(string $name) : Expression
Requires server version 5.6.0+.
Parameters
- $name : string
Return values
ExpressionvoidTime()
Create function that returns record expiration time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
public
static voidTime() : Expression
Return values
Expressionwildcard()
Create a WildCard PHPValue
public
static wildcard() : Expression
Return values
Expressionxor()
Create "xor" (^) operator that applies to a variable number of expressions.
public
static xor(array<string|int, mixed> $exps) : Expression
Parameters
- $exps : array<string|int, mixed>