classJsonSerialize
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.
(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 JsonValueExpression $valuepublic JsonReturning|null $returning = nullMethods§
public function __construct(
public JsonValueExpression $value,
public JsonReturning|null $returning = null,
)Parameters
$value | JsonValueExpression | The JSON value |
$returning | JsonReturning|null | The RETURNING clause |
public function outputName(): NameNames an unaliased result column.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the value and the returning type, and the NULL fact.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call JsonValueExpression::deriveValue() line 59
- new Known line 61
- class-const Builtin::Text() line 61
- new ScalarFact line 63
- class-const Nullability::Nullable() line 63
public function render(Output $out): voidWrites JSON_SERIALIZE with the value and the clause.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 71
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.