classJsonParse
final class JsonParse
implements Scalar, OutputNaming
uses Snapshot
Public API: explicitly declared with
@visibility public.JSON (value [WITH | WITHOUT UNIQUE KEYS]): a text or byte string parsed as json (PostgreSQL 17).
Mirrors PostgreSQL's JsonParseExpr. Rule: PG-JSON-PARSE-001. Facts: json, NULL exactly when the value is. The result column is named json. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE. Status: Implemented.
$parse = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonParse(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()), new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonUniqueKeys(true));
[$parse->unique->unique, $parse->outputName()->value] // => [true, 'json']Properties§
public JsonValueExpression $valuepublic JsonUniqueKeys|null $unique = nullMethods§
public function __construct(
public JsonValueExpression $value,
public JsonUniqueKeys|null $unique = null,
)Parameters
$value | JsonValueExpression | The value parsed |
$unique | JsonUniqueKeys|null | The uniqueness clause written |
Calls 3
- static-call Check::input() line 46
- method-call Precedence::takesUniqueness() line 46
- new Precedence line 46
public function outputName(): NameNames an unaliased result column.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the value, the type and the NULL fact.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call JsonValueExpression::deriveValue() line 62
- new ScalarFact line 64
- new Known line 64
- class-const Builtin::Json() line 64
- class-const Nullability::Nullable() line 64
public function render(Output $out): voidWrites JSON with the value and the uniqueness clause.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 72
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.