packages/sql-semantics-postgres/resources/models/Value/IndexStmtWithCreateOptUniqueIndexOptConcurrentlyOptSingleNameOnRelationExprAccessMethodC_99a5bd5e.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\PostgreSql\Value;
6
7/**
8 * The IndexStmt 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\IndexStmtWithCreateOptUniqueIndexOptConcurrentlyOptSingleNameOnRelationExprAccessMethodC_99a5bd5e $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class IndexStmtWithCreateOptUniqueIndexOptConcurrentlyOptSingleNameOnRelationExprAccessMethodC_99a5bd5e implements \SqlSemantics\Statement\Model\PostgreSql\Role\IndexStmtForm, \SqlSemantics\Statement\Model\PostgreSql\Role\ParseToplevelForm, \SqlSemantics\Statement\Model\PostgreSql\Role\RoutineBodyStmtForm, \SqlSemantics\Statement\Model\PostgreSql\Role\SchemaStmtForm, \SqlSemantics\Statement\Model\PostgreSql\Role\StmtForm, \SqlSemantics\Statement\Model\PostgreSql\Role\StmtmultiForm, \SqlSemantics\Statement\Model\PostgreSql\Role\ToplevelStmtForm, \SqlSemantics\Statement\Command
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\OptUniqueForm $optUnique,
24 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptConcurrentlyForm $optConcurrently,
25 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptSingleNameForm $optSingleName,
26 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\RelationExprForm $relationExpr,
27 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\AccessMethodClauseForm $accessMethodClause,
28 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\IndexParamsForm $indexParams,
29 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptIncludeForm $optInclude,
30 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptUniqueNullTreatmentForm $optUniqueNullTreatment,
31 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptReloptionsForm $optReloptions,
32 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace,
33 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\WhereClauseForm $where,
34 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
35 ) {
36 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optUnique), 'The optUnique must be a generated immutable SQL value.');
37 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optConcurrently), 'The optConcurrently must be a generated immutable SQL value.');
38 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optSingleName), 'The optSingleName must be a generated immutable SQL value.');
39 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($relationExpr), 'The relationExpr must be a generated immutable SQL value.');
40 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($accessMethodClause), 'The accessMethodClause must be a generated immutable SQL value.');
41 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($indexParams), 'The indexParams must be a generated immutable SQL value.');
42 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optInclude), 'The optInclude must be a generated immutable SQL value.');
43 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optUniqueNullTreatment), 'The optUniqueNullTreatment must be a generated immutable SQL value.');
44 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optReloptions), 'The optReloptions must be a generated immutable SQL value.');
45 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optTableSpace), 'The optTableSpace must be a generated immutable SQL value.');
46 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($where), 'The where must be a generated immutable SQL value.');
47 }
48
49 /**
50 * Writes SQL entirely from this value's fields.
51 */
52 public function write(\SqlSemantics\Statement\Writer $writer): void
53 {
54 $writer->comments($this->comments, 0);
55 $writer->append('CREATE');
56 $writer->comments($this->comments, 1);
57 $this->optUnique->write($writer);
58 $writer->comments($this->comments, 2);
59 $writer->append('INDEX');
60 $writer->comments($this->comments, 3);
61 $this->optConcurrently->write($writer);
62 $writer->comments($this->comments, 4);
63 $this->optSingleName->write($writer);
64 $writer->comments($this->comments, 5);
65 $writer->append('ON');
66 $writer->comments($this->comments, 6);
67 $this->relationExpr->write($writer);
68 $writer->comments($this->comments, 7);
69 $this->accessMethodClause->write($writer);
70 $writer->comments($this->comments, 8);
71 $writer->append('(');
72 $writer->comments($this->comments, 9);
73 $this->indexParams->write($writer);
74 $writer->comments($this->comments, 10);
75 $writer->append(')');
76 $writer->comments($this->comments, 11);
77 $this->optInclude->write($writer);
78 $writer->comments($this->comments, 12);
79 $this->optUniqueNullTreatment->write($writer);
80 $writer->comments($this->comments, 13);
81 $this->optReloptions->write($writer);
82 $writer->comments($this->comments, 14);
83 $this->optTableSpace->write($writer);
84 $writer->comments($this->comments, 15);
85 $this->where->write($writer);
86 }
87
88 /**
89 * Returns a copy with a new optUnique, preserving every other field.
90 */
91 public function withOptUnique(\SqlSemantics\Statement\Model\PostgreSql\Role\OptUniqueForm $optUnique): self
92 {
93 return new self($optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
94 }
95
96 /**
97 * Returns a copy with a new optConcurrently, preserving every other field.
98 */
99 public function withOptConcurrently(\SqlSemantics\Statement\Model\PostgreSql\Role\OptConcurrentlyForm $optConcurrently): self
100 {
101 return new self($this->optUnique, $optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
102 }
103
104 /**
105 * Returns a copy with a new optSingleName, preserving every other field.
106 */
107 public function withOptSingleName(\SqlSemantics\Statement\Model\PostgreSql\Role\OptSingleNameForm $optSingleName): self
108 {
109 return new self($this->optUnique, $this->optConcurrently, $optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
110 }
111
112 /**
113 * Returns a copy with a new relationExpr, preserving every other field.
114 */
115 public function withRelationExpr(\SqlSemantics\Statement\Model\PostgreSql\Role\RelationExprForm $relationExpr): self
116 {
117 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
118 }
119
120 /**
121 * Returns a copy with a new accessMethodClause, preserving every other field.
122 */
123 public function withAccessMethodClause(\SqlSemantics\Statement\Model\PostgreSql\Role\AccessMethodClauseForm $accessMethodClause): self
124 {
125 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
126 }
127
128 /**
129 * Returns a copy with a new indexParams, preserving every other field.
130 */
131 public function withIndexParams(\SqlSemantics\Statement\Model\PostgreSql\Role\IndexParamsForm $indexParams): self
132 {
133 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
134 }
135
136 /**
137 * Returns a copy with a new optInclude, preserving every other field.
138 */
139 public function withOptInclude(\SqlSemantics\Statement\Model\PostgreSql\Role\OptIncludeForm $optInclude): self
140 {
141 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
142 }
143
144 /**
145 * Returns a copy with a new optUniqueNullTreatment, preserving every other field.
146 */
147 public function withOptUniqueNullTreatment(\SqlSemantics\Statement\Model\PostgreSql\Role\OptUniqueNullTreatmentForm $optUniqueNullTreatment): self
148 {
149 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $this->comments);
150 }
151
152 /**
153 * Returns a copy with a new optReloptions, preserving every other field.
154 */
155 public function withOptReloptions(\SqlSemantics\Statement\Model\PostgreSql\Role\OptReloptionsForm $optReloptions): self
156 {
157 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $optReloptions, $this->optTableSpace, $this->where, $this->comments);
158 }
159
160 /**
161 * Returns a copy with a new optTableSpace, preserving every other field.
162 */
163 public function withOptTableSpace(\SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace): self
164 {
165 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $optTableSpace, $this->where, $this->comments);
166 }
167
168 /**
169 * Returns a copy with a new where, preserving every other field.
170 */
171 public function withWhere(\SqlSemantics\Statement\Model\PostgreSql\Role\WhereClauseForm $where): self
172 {
173 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $where, $this->comments);
174 }
175
176 /**
177 * Returns a copy with a new comments, preserving every other field.
178 */
179 public function withComments(\SqlSemantics\Statement\Comments $comments): self
180 {
181 return new self($this->optUnique, $this->optConcurrently, $this->optSingleName, $this->relationExpr, $this->accessMethodClause, $this->indexParams, $this->optInclude, $this->optUniqueNullTreatment, $this->optReloptions, $this->optTableSpace, $this->where, $comments);
182 }
183}
184