packages/sql-semantics-sqlite/resources/models/Value/SeltablistWithStlPrefixNmDbnmAsIndexedByOnUsing_cb25a795.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\Sqlite\Value;
6
7/**
8 * The seltablist 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\Sqlite\Value\SeltablistWithStlPrefixNmDbnmAsIndexedByOnUsing_cb25a795 $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class SeltablistWithStlPrefixNmDbnmAsIndexedByOnUsing_cb25a795 implements \SqlSemantics\Statement\Model\Sqlite\Role\SeltablistForm
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\Sqlite\Role\StlPrefixForm $stlPrefix,
24 public readonly \SqlSemantics\Statement\Model\Sqlite\Role\NmForm $nm,
25 public readonly \SqlSemantics\Statement\Model\Sqlite\Role\DbnmForm $dbnm,
26 public readonly \SqlSemantics\Statement\Model\Sqlite\Role\AsForm $as,
27 public readonly \SqlSemantics\Statement\Model\Sqlite\Role\IndexedByForm $indexedBy,
28 public readonly \SqlSemantics\Statement\Model\Sqlite\Role\OnUsingForm $onUsing,
29 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
30 ) {
31 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($stlPrefix), 'The stlPrefix must be a generated immutable SQL value.');
32 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($nm), 'The nm must be a generated immutable SQL value.');
33 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($dbnm), 'The dbnm must be a generated immutable SQL value.');
34 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($as), 'The as must be a generated immutable SQL value.');
35 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($indexedBy), 'The indexedBy must be a generated immutable SQL value.');
36 $this->assert(\SqlSemantics\Statement\Model\Sqlite\Contract\Contracts::contains($onUsing), 'The onUsing must be a generated immutable SQL value.');
37 }
38
39 /**
40 * Writes SQL entirely from this value's fields.
41 */
42 public function write(\SqlSemantics\Statement\Writer $writer): void
43 {
44 $writer->comments($this->comments, 0);
45 $this->stlPrefix->write($writer);
46 $writer->comments($this->comments, 1);
47 $this->nm->write($writer);
48 $writer->comments($this->comments, 2);
49 $this->dbnm->write($writer);
50 $writer->comments($this->comments, 3);
51 $this->as->write($writer);
52 $writer->comments($this->comments, 4);
53 $this->indexedBy->write($writer);
54 $writer->comments($this->comments, 5);
55 $this->onUsing->write($writer);
56 }
57
58 /**
59 * Returns a copy with a new stlPrefix, preserving every other field.
60 */
61 public function withStlPrefix(\SqlSemantics\Statement\Model\Sqlite\Role\StlPrefixForm $stlPrefix): self
62 {
63 return new self($stlPrefix, $this->nm, $this->dbnm, $this->as, $this->indexedBy, $this->onUsing, $this->comments);
64 }
65
66 /**
67 * Returns a copy with a new nm, preserving every other field.
68 */
69 public function withNm(\SqlSemantics\Statement\Model\Sqlite\Role\NmForm $nm): self
70 {
71 return new self($this->stlPrefix, $nm, $this->dbnm, $this->as, $this->indexedBy, $this->onUsing, $this->comments);
72 }
73
74 /**
75 * Returns a copy with a new dbnm, preserving every other field.
76 */
77 public function withDbnm(\SqlSemantics\Statement\Model\Sqlite\Role\DbnmForm $dbnm): self
78 {
79 return new self($this->stlPrefix, $this->nm, $dbnm, $this->as, $this->indexedBy, $this->onUsing, $this->comments);
80 }
81
82 /**
83 * Returns a copy with a new as, preserving every other field.
84 */
85 public function withAs(\SqlSemantics\Statement\Model\Sqlite\Role\AsForm $as): self
86 {
87 return new self($this->stlPrefix, $this->nm, $this->dbnm, $as, $this->indexedBy, $this->onUsing, $this->comments);
88 }
89
90 /**
91 * Returns a copy with a new indexedBy, preserving every other field.
92 */
93 public function withIndexedBy(\SqlSemantics\Statement\Model\Sqlite\Role\IndexedByForm $indexedBy): self
94 {
95 return new self($this->stlPrefix, $this->nm, $this->dbnm, $this->as, $indexedBy, $this->onUsing, $this->comments);
96 }
97
98 /**
99 * Returns a copy with a new onUsing, preserving every other field.
100 */
101 public function withOnUsing(\SqlSemantics\Statement\Model\Sqlite\Role\OnUsingForm $onUsing): self
102 {
103 return new self($this->stlPrefix, $this->nm, $this->dbnm, $this->as, $this->indexedBy, $onUsing, $this->comments);
104 }
105
106 /**
107 * Returns a copy with a new comments, preserving every other field.
108 */
109 public function withComments(\SqlSemantics\Statement\Comments $comments): self
110 {
111 return new self($this->stlPrefix, $this->nm, $this->dbnm, $this->as, $this->indexedBy, $this->onUsing, $comments);
112 }
113}
114