packages/sql-semantics-postgres/resources/models/Value/CreateMvTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptReloptionsOptTableSpace_48fc435e.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\PostgreSql\Value;
6
7/**
8 * The create_mv_target SQL value; generated by bin/build-models.php.
9 *
10 * @visibility public
11 * @example Accept a structured SQL value
12 *     $write = static fn (\SqlSemantics\Statement\Model\PostgreSql\Value\CreateMvTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptReloptionsOptTableSpace_48fc435e $value): string => \SqlSemantics\Statement\Writer::render($value);
13 *     $write instanceof \Closure // => true
14 */
15final class CreateMvTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptReloptionsOptTableSpace_48fc435e implements \SqlSemantics\Statement\Model\PostgreSql\Role\CreateMvTargetForm
16{
17    use \SqlSemantics\Statement\Assertion;
18
19    /**
20     * Supplies the SQL values of this form; comments are kept by the position of the symbol each precedes.
21     */
22    public function __construct(
23        public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\QualifiedNameForm $qualifiedName,
24        public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptColumnListForm $optColumnList,
25        public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\TableAccessMethodClauseForm $tableAccessMethodClause,
26        public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptReloptionsForm $optReloptions,
27        public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace,
28        public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
29    ) {
30        $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($qualifiedName), 'The qualifiedName must be a generated immutable SQL value.');
31        $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optColumnList), 'The optColumnList must be a generated immutable SQL value.');
32        $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($tableAccessMethodClause), 'The tableAccessMethodClause must be a generated immutable SQL value.');
33        $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optReloptions), 'The optReloptions must be a generated immutable SQL value.');
34        $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optTableSpace), 'The optTableSpace must be a generated immutable SQL value.');
35    }
36
37    /**
38     * Writes SQL entirely from this value's fields.
39     */
40    public function write(\SqlSemantics\Statement\Writer $writer): void
41    {
42        $writer->comments($this->comments, 0);
43        $this->qualifiedName->write($writer);
44        $writer->comments($this->comments, 1);
45        $this->optColumnList->write($writer);
46        $writer->comments($this->comments, 2);
47        $this->tableAccessMethodClause->write($writer);
48        $writer->comments($this->comments, 3);
49        $this->optReloptions->write($writer);
50        $writer->comments($this->comments, 4);
51        $this->optTableSpace->write($writer);
52    }
53
54    /**
55     * Returns a copy with a new qualifiedName, preserving every other field.
56     */
57    public function withQualifiedName(\SqlSemantics\Statement\Model\PostgreSql\Role\QualifiedNameForm $qualifiedName): self
58    {
59        return new self($qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optReloptions, $this->optTableSpace, $this->comments);
60    }
61
62    /**
63     * Returns a copy with a new optColumnList, preserving every other field.
64     */
65    public function withOptColumnList(\SqlSemantics\Statement\Model\PostgreSql\Role\OptColumnListForm $optColumnList): self
66    {
67        return new self($this->qualifiedName, $optColumnList, $this->tableAccessMethodClause, $this->optReloptions, $this->optTableSpace, $this->comments);
68    }
69
70    /**
71     * Returns a copy with a new tableAccessMethodClause, preserving every other field.
72     */
73    public function withTableAccessMethodClause(\SqlSemantics\Statement\Model\PostgreSql\Role\TableAccessMethodClauseForm $tableAccessMethodClause): self
74    {
75        return new self($this->qualifiedName, $this->optColumnList, $tableAccessMethodClause, $this->optReloptions, $this->optTableSpace, $this->comments);
76    }
77
78    /**
79     * Returns a copy with a new optReloptions, preserving every other field.
80     */
81    public function withOptReloptions(\SqlSemantics\Statement\Model\PostgreSql\Role\OptReloptionsForm $optReloptions): self
82    {
83        return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $optReloptions, $this->optTableSpace, $this->comments);
84    }
85
86    /**
87     * Returns a copy with a new optTableSpace, preserving every other field.
88     */
89    public function withOptTableSpace(\SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace): self
90    {
91        return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optReloptions, $optTableSpace, $this->comments);
92    }
93
94    /**
95     * Returns a copy with a new comments, preserving every other field.
96     */
97    public function withComments(\SqlSemantics\Statement\Comments $comments): self
98    {
99        return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optReloptions, $this->optTableSpace, $comments);
100    }
101}
102