final class JsonArrayQuery
    implements Scalar, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

JSON_ARRAY (query [FORMAT JSON] [RETURNING type]): the rows of a one-column query as a JSON array.

Mirrors PostgreSQL's JsonArrayQueryConstructor; the query is written without parentheses. Rule: PG-JSON-ARRAY-QUERY-001. Facts: the query is derived as a subquery at the position; the RETURNING type, otherwise json; never NULL. Diagnostics: a query of more than one column. The result column is named json_array. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE. Status: Implemented.

Telling the class plays the expression roledoctest
is_subclass_of(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonArrayQuery::class, \SqlSemantics\Platform\PostgreSql\Model\Statement\Scalar::class) // => true

Properties§

public Query $query
public JsonFormat|null $format = null
public JsonReturning|null $returning = null

Methods§

public function __construct(
    public Query $query,
    public JsonFormat|null $format = null,
    public JsonReturning|null $returning = null,
)

Parameters

$queryQueryThe query whose rows become the elements
$formatJsonFormat|nullThe format written for the query's values
$returningJsonReturning|nullThe RETURNING clause
public function outputName(): Name

Names an unaliased result column.

Returns

Calls 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the query and the returning type, reporting a query of several columns.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 8
public function render(Output $out): void

Writes JSON_ARRAY with the query and the clauses.

Parameters

$outOutput
Calls 1

Test cases 3§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3

Relations§

Instantiated in 1