classExpressionPart
final class ExpressionPart
implements KeyPart
uses Snapshot
Public API: explicitly declared with
@visibility public.A functional key part: an expression in parentheses that the index stores (MySQL 8.0.13 and later).
The expression sees the columns of the indexed table. Source: https://dev.mysql.com/doc/refman/8.4/en/create-index.html#create-index-functional-key-parts.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (a INT, KEY ((a + 1)))');
$create->statement->elements[1]->parts[0] instanceof \SqlSemantics\Platform\MySql\Statement\Table\Key\ExpressionPart // => trueProperties§
public Scalar $expressionpublic Direction|null $direction = nullMethods§
public function __construct(public Scalar $expression, public Direction|null $direction = null)Parameters
$expression | Scalar | The indexed expression |
$direction | Direction|null | The sort direction, when written |
public function deriveKeyPart(Derivation $derivation, Environment $scope): voidDerives the expression at the position of the indexed table.
Parameters
$derivation | Derivation | |
$scope | Environment |
Test cases 1
Calls 1
- method-call Derivation::scalar() line 42
public function render(Output $out): voidWrites the parenthesized expression and the direction.
Parameters
$out | Output |
Calls 2
- method-call Output::symbol() line 50
- method-call Output::keyword() line 52
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.