packages/sql-semantics-postgres/src/Model/Resolution/VisibleRelation.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\PostgreSql\Model\Resolution;
6
7use SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name;
8use SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName;
9use SqlSemantics\Platform\PostgreSql\Model\Statement\Relation;
10use SqlSemantics\Platform\PostgreSql\Model\Statement\Shape\RowShape;
11
12/**
13 * A relation occurrence as one position of a query sees it: its shape and the names that qualify it.
14 *
15 * An occurrence with neither alias nor name, such as the merged columns of a
16 * join, is found by unqualified names only.
17 *
18 * @visibility SqlSemantics
19 */
20final class VisibleRelation
21{
22 use \SqlSemantics\Platform\PostgreSql\Model\Statement\Snapshot;
23
24 /**
25 * @param Relation $relation The occurrence
26 * @param RowShape $shape The row shape visible at this position
27 * @param Name|null $alias The correlation name; when present it is the only qualifier
28 * @param QualifiedName|null $name The relation name that qualifies the occurrence when it has no alias
29 * @param list<int> $hidden The slot positions an unqualified name and a star do not see, such as the duplicate of a merged join column
30 * @param list<ImplicitSlot> $implicit The slots found by name only
31 */
32 public function __construct(
33 public readonly Relation $relation,
34 public readonly RowShape $shape,
35 public readonly ?Name $alias = null,
36 public readonly ?QualifiedName $name = null,
37 public readonly array $hidden = [],
38 public readonly array $implicit = [],
39 ) {
40 }
41}
42