classJsonFormat
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.
(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::Utf16new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonFormat(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('latin1')) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public Name|null $encodingName = nullMethods§
public function __construct(public Name|null $encodingName = null)Parameters
$encodingName | Name|null | The encoding name written after ENCODING |
Calls 2
- static-call Check::input() line 38
- static-call JsonEncoding::named() line 38
public function encoding(): ?JsonEncodingAnswers the encoding written, or null when none is.
Returns
Test cases 1
Calls 1
- static-call JsonEncoding::named() line 46
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives nothing: the clause holds no expression.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
public function render(Output $out): voidWrites FORMAT JSON and the encoding.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::keyword() line 61
- class-const NameUse::Column() line 63
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
JsonChecksTest::testInputReportsAnEncodingOnANonByteaValuecallsJsonChecksTest::testQueryReportsFormatInReturningAndQuotesWithWrappercallsJsonReturningTest::testRenderWritesTheTypeAndFormatcallsJsonValueExpressionTest::testDeriveValueReportsAnEncodingOnTextcallsJsonValueExpressionTest::testRenderWritesTheFormatcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\JsonRule::format() packages/sql-semantics-postgres/src/Lowering/Invocation/JsonRule.php:253
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\JsonRule::format() packages/sql-semantics-postgres/src/Lowering/Invocation/JsonRule.php:254
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\JsonRule::format() packages/sql-semantics-postgres/src/Lowering/Invocation/JsonRule.php:255
Type declarations 5
- type SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:164
- type SqlSemantics\Platform\PostgreSql\Lowering\Invocation\JsonRule packages/sql-semantics-postgres/src/Lowering/Invocation/JsonRule.php:246
- type SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonArrayQuery packages/sql-semantics-postgres/src/Statement/Invocation/Json/Constructor/JsonArrayQuery.php:47
- type SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonReturning packages/sql-semantics-postgres/src/Statement/Invocation/Json/JsonReturning.php:34
- type SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression packages/sql-semantics-postgres/src/Statement/Invocation/Json/JsonValueExpression.php:36