packages/sql-semantics-postgres/src/Model/Statement/Reference/Missing/IncompleteMembers.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\PostgreSql\Model\Statement\Reference\Missing;
6
7use SqlSemantics\Platform\PostgreSql\Model\Statement\Declaration\Table;
8use SqlSemantics\Platform\PostgreSql\Model\Statement\Snapshot;
9
10/**
11 * A declared relation whose member list the context marks as incomplete.
12 *
13 * @visibility public
14 * @example Describing an incomplete member list
15 *     $profile = (new \SqlSemantics\Platform\PostgreSql\Semantics())->profile();
16 *     $table = new \SqlSemantics\Platform\PostgreSql\Model\Statement\Declaration\Table(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('t')), $profile, [], [], false);
17 *     (new \SqlSemantics\Platform\PostgreSql\Model\Statement\Reference\Missing\IncompleteMembers($table))->describe() // => 'the complete column list of relation t'
18 */
19final class IncompleteMembers implements MissingInput
20{
21    use Snapshot;
22
23    /**
24     * @param Table $table The declaration with an incomplete column list
25     */
26    public function __construct(public readonly Table $table)
27    {
28    }
29
30    /**
31     * Describes the missing members.
32     */
33    public function describe(): string
34    {
35        return 'the complete column list of relation ' . $this->table->name->name->value;
36    }
37}
38