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

A key and its value in JSON_OBJECT or JSON_OBJECTAGG.

Mirrors PostgreSQL's JsonPair node. With the VALUE spelling the key is a primary expression; a key that would need parentheses is rejected. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE.

Reading a key and value pairdoctest
$pair = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonPair(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral(), new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()));
    $pair->spelling->value // => ':'

Properties§

public Scalar $key
public KeyValueSpelling $spelling = KeyValueSpelling::Colon

Methods§

public function __construct(
    public Scalar $key,
    public JsonValueExpression $value,
    public KeyValueSpelling $spelling = KeyValueSpelling::Colon,
)

Parameters

$keyScalarThe key
$valueJsonValueExpressionThe value
$spellingKeyValueSpellingHow the key joins the value
Calls 4
public function render(Output $out): void

Writes the key, the joining word or symbol, and the value.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 10§

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

Dedicated tests 3
Other tests reaching this symbol 7

Relations§

Instantiated in 1
Method calls 1
Constant reads 1
Type declarations 3