final class JsonValueExpression
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

A value passed to an SQL/JSON function, with an optional FORMAT clause.

Mirrors PostgreSQL's JsonValueExpr. Whoever holds it derives it once, through deriveValue(), to read the value's facts. An ENCODING on a value that is not bytea is reported (PG-JSON-CHECKS-001). Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE.

Reading a value without a formatdoctest
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()))->format // => null

Properties§

public Scalar $value
public JsonFormat|null $format = null

Methods§

public function __construct(public Scalar $value, public JsonFormat|null $format = null)

Parameters

$valueScalarThe value
$formatJsonFormat|nullThe format written
public function deriveValue(
    Derivation $derivation,
    Environment $environment,
    bool $parsed = false,
): ScalarFact

Derives the value and answers its facts.

Parameters

$derivationDerivation
$environmentEnvironment
$parsedboolWhether the value is parsed as the context item or the operand of JSON(), which words the encoding problem differently

Returns

Test cases 2
Called from 7
Calls 3
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the value.

Parameters

$derivationDerivation
$environmentEnvironment
Test cases 1
Calls 1
public function render(Output $out): void

Writes the value and the format.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 37§

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

Dedicated tests 4
Other tests reaching this symbol 33

Relations§

Instantiated in 1
Method calls 6
Constant reads 1
Type checks 1
Type declarations 9