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

FORMAT JSON [ENCODING name]: the value is JSON text in an encoding.

Mirrors PostgreSQL's JsonFormat node with format JSON. The encoding name is kept as written; the server compares it without case. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE.

Reading the encoding of a formatdoctest
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonFormat(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('utf16')))->encoding() // => \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonEncoding::Utf16
Rejecting an unknown encodingdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonFormat(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('latin1')) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public Name|null $encodingName = null

Methods§

public function __construct(public Name|null $encodingName = null)

Parameters

$encodingNameName|nullThe encoding name written after ENCODING
Calls 2
public function encoding(): ?JsonEncoding

Answers the encoding written, or null when none is.

Returns

Test cases 1
Calls 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives nothing: the clause holds no expression.

Parameters

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

Writes FORMAT JSON and the encoding.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 9§

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 5

Relations§

Instantiated in 3
Type declarations 5