packages/sql-semantics-mysql/resources/models/Value/SelectPart2WithSelectOptionsAndItemListOptIntoFromClauseOptWhereClauseOptGroupClauseOptHav_56b5ba2c.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\MySql\Value;
6
7/**
8 * The select_part2 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\MySql\Value\SelectPart2WithSelectOptionsAndItemListOptIntoFromClauseOptWhereClauseOptGroupClauseOptHav_56b5ba2c $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class SelectPart2WithSelectOptionsAndItemListOptIntoFromClauseOptWhereClauseOptGroupClauseOptHav_56b5ba2c implements \SqlSemantics\Statement\Model\MySql\Role\SelectPart2Form
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\MySql\Role\SelectOptionsAndItemListForm $selectOptionsAndItemList,
24 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptIntoForm $optInto,
25 public readonly \SqlSemantics\Statement\Model\MySql\Role\FromClauseForm $from,
26 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptWhereClauseForm $where,
27 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptGroupClauseForm $optGroupClause,
28 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptHavingClauseForm $optHavingClause,
29 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptOrderClauseForm $orderBy,
30 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptLimitClauseForm $optLimitClause,
31 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptProcedureAnalyseClauseForm $optProcedureAnalyseClause,
32 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptIntoForm $optInto2,
33 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptSelectLockTypeForm $optSelectLockType,
34 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
35 ) {
36 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($selectOptionsAndItemList), 'The selectOptionsAndItemList must be a generated immutable SQL value.');
37 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optInto), 'The optInto must be a generated immutable SQL value.');
38 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($from), 'The from must be a generated immutable SQL value.');
39 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($where), 'The where must be a generated immutable SQL value.');
40 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optGroupClause), 'The optGroupClause must be a generated immutable SQL value.');
41 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optHavingClause), 'The optHavingClause must be a generated immutable SQL value.');
42 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($orderBy), 'The orderBy must be a generated immutable SQL value.');
43 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optLimitClause), 'The optLimitClause must be a generated immutable SQL value.');
44 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optProcedureAnalyseClause), 'The optProcedureAnalyseClause must be a generated immutable SQL value.');
45 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optInto2), 'The optInto2 must be a generated immutable SQL value.');
46 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optSelectLockType), 'The optSelectLockType 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 $this->selectOptionsAndItemList->write($writer);
56 $writer->comments($this->comments, 1);
57 $this->optInto->write($writer);
58 $writer->comments($this->comments, 2);
59 $this->from->write($writer);
60 $writer->comments($this->comments, 3);
61 $this->where->write($writer);
62 $writer->comments($this->comments, 4);
63 $this->optGroupClause->write($writer);
64 $writer->comments($this->comments, 5);
65 $this->optHavingClause->write($writer);
66 $writer->comments($this->comments, 6);
67 $this->orderBy->write($writer);
68 $writer->comments($this->comments, 7);
69 $this->optLimitClause->write($writer);
70 $writer->comments($this->comments, 8);
71 $this->optProcedureAnalyseClause->write($writer);
72 $writer->comments($this->comments, 9);
73 $this->optInto2->write($writer);
74 $writer->comments($this->comments, 10);
75 $this->optSelectLockType->write($writer);
76 }
77
78 /**
79 * Returns a copy with a new selectOptionsAndItemList, preserving every other field.
80 */
81 public function withSelectOptionsAndItemList(\SqlSemantics\Statement\Model\MySql\Role\SelectOptionsAndItemListForm $selectOptionsAndItemList): self
82 {
83 return new self($selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
84 }
85
86 /**
87 * Returns a copy with a new optInto, preserving every other field.
88 */
89 public function withOptInto(\SqlSemantics\Statement\Model\MySql\Role\OptIntoForm $optInto): self
90 {
91 return new self($this->selectOptionsAndItemList, $optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
92 }
93
94 /**
95 * Returns a copy with a new from, preserving every other field.
96 */
97 public function withFrom(\SqlSemantics\Statement\Model\MySql\Role\FromClauseForm $from): self
98 {
99 return new self($this->selectOptionsAndItemList, $this->optInto, $from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
100 }
101
102 /**
103 * Returns a copy with a new where, preserving every other field.
104 */
105 public function withWhere(\SqlSemantics\Statement\Model\MySql\Role\OptWhereClauseForm $where): self
106 {
107 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
108 }
109
110 /**
111 * Returns a copy with a new optGroupClause, preserving every other field.
112 */
113 public function withOptGroupClause(\SqlSemantics\Statement\Model\MySql\Role\OptGroupClauseForm $optGroupClause): self
114 {
115 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
116 }
117
118 /**
119 * Returns a copy with a new optHavingClause, preserving every other field.
120 */
121 public function withOptHavingClause(\SqlSemantics\Statement\Model\MySql\Role\OptHavingClauseForm $optHavingClause): self
122 {
123 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
124 }
125
126 /**
127 * Returns a copy with a new orderBy, preserving every other field.
128 */
129 public function withOrderBy(\SqlSemantics\Statement\Model\MySql\Role\OptOrderClauseForm $orderBy): self
130 {
131 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
132 }
133
134 /**
135 * Returns a copy with a new optLimitClause, preserving every other field.
136 */
137 public function withOptLimitClause(\SqlSemantics\Statement\Model\MySql\Role\OptLimitClauseForm $optLimitClause): self
138 {
139 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
140 }
141
142 /**
143 * Returns a copy with a new optProcedureAnalyseClause, preserving every other field.
144 */
145 public function withOptProcedureAnalyseClause(\SqlSemantics\Statement\Model\MySql\Role\OptProcedureAnalyseClauseForm $optProcedureAnalyseClause): self
146 {
147 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $this->comments);
148 }
149
150 /**
151 * Returns a copy with a new optInto2, preserving every other field.
152 */
153 public function withOptInto2(\SqlSemantics\Statement\Model\MySql\Role\OptIntoForm $optInto2): self
154 {
155 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $optInto2, $this->optSelectLockType, $this->comments);
156 }
157
158 /**
159 * Returns a copy with a new optSelectLockType, preserving every other field.
160 */
161 public function withOptSelectLockType(\SqlSemantics\Statement\Model\MySql\Role\OptSelectLockTypeForm $optSelectLockType): self
162 {
163 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $optSelectLockType, $this->comments);
164 }
165
166 /**
167 * Returns a copy with a new comments, preserving every other field.
168 */
169 public function withComments(\SqlSemantics\Statement\Comments $comments): self
170 {
171 return new self($this->selectOptionsAndItemList, $this->optInto, $this->from, $this->where, $this->optGroupClause, $this->optHavingClause, $this->orderBy, $this->optLimitClause, $this->optProcedureAnalyseClause, $this->optInto2, $this->optSelectLockType, $comments);
172 }
173}
174