classJsonNestedColumns
final class JsonNestedColumns
implements JsonTableColumn
uses Snapshot
Public API: explicitly declared with
@visibility public.NESTED [PATH] path [AS name] COLUMNS (…): columns read from the items a path yields within the row.
Mirrors PostgreSQL's JsonTableColumn of type JTC_NESTED. The PATH word is optional and always written. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-SQLJSON-TABLE.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics('pg-17.2'))->analyze("SELECT * FROM JSON_TABLE ('[]', '$[*]' COLUMNS (NESTED '$.b[*]' COLUMNS (b text)))");
[$query->field(0)->name->value, $query->toString()] // => ['b', "SELECT * FROM JSON_TABLE ('[]', '$[*]' COLUMNS (NESTED PATH '$.b[*]' COLUMNS (b text)))"]Properties§
public non-empty-list<JsonTableColumn> $columnspublic StringConstant $pathpublic Name|null $pathName = nullMethods§
public function __construct(
public StringConstant $path,
list<JsonTableColumn> $columns,
public Name|null $pathName = null,
)Parameters
$path | StringConstant | The path of the nested items |
$columns | list<JsonTableColumn> | The nested columns in written order; at least one |
$pathName | Name|null | The name of the path |
Calls 2
- static-call Check::listOf() line 42
- class-const JsonTableColumn::class() line 42
public function render(Output $out): voidWrites NESTED PATH, the path, its name and the columns.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 50
- class-const NameUse::Column() line 52
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
JsonNestedColumnsTestcalls