classSlice
final class Slice
implements IndirectionStep
uses Snapshot
Public API: explicitly declared with
@visibility public.The indirection step [ lower : upper ]: a slice of an array; an omitted bound is the array's own bound.
Mirrors an A_Indices item with is_slice true. Source: https://www.postgresql.org/docs/17/arrays.html#ARRAYS-ACCESSING.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT $1[:2]');
[$query->field(0)->expression->steps[0]->lower, $query->toString()] // => [null, 'SELECT $1 [: 2]']Properties§
public Scalar|null $lowerpublic Scalar|null $upperMethods§
public function __construct(public Scalar|null $lower, public Scalar|null $upper)Parameters
$lower | Scalar|null | The lower bound, or null when omitted |
$upper | Scalar|null | The upper bound, or null when omitted |
public function field(): ?Namepublic function deriveClause(Derivation $derivation, Environment $environment): voidDerives the written bounds.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Calls 1
- method-call Derivation::scalar() line 53
public function render(Output $out): voidWrites the bounds around a colon in brackets.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::symbol() line 63
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Subscripting::subscript() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Subscripting.php:97
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Expression\Indirection::__construct() packages/sql-semantics-postgres/src/Statement/Expression/Indirection.php:67