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

JSON_SERIALIZE (value [RETURNING type]): a JSON value as a character or byte string (PostgreSQL 17).

Mirrors PostgreSQL's JsonSerializeExpr. Rule: PG-JSON-SERIALIZE-001. Facts: the RETURNING type, otherwise text; NULL exactly when the value is. The result column is named json_serialize. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE. Status: Implemented.

Naming the result columndoctest
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonSerialize(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral())))->outputName()->value // => 'json_serialize'

Properties§

public JsonReturning|null $returning = null

Methods§

public function __construct(
    public JsonValueExpression $value,
    public JsonReturning|null $returning = null,
)

Parameters

$valueJsonValueExpressionThe JSON value
$returningJsonReturning|nullThe RETURNING clause
public function outputName(): Name

Names an unaliased result column.

Returns

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

Derives the value and the returning type, and the NULL fact.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes JSON_SERIALIZE with the value and the clause.

Parameters

$outOutput
Test cases 1
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