packages/sql-semantics-postgres/resources/models/Value/CreateAsTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptWithOnCommitOptionOptTa_cee3248c.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\PostgreSql\Value;
6
7/**
8 * The create_as_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\CreateAsTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptWithOnCommitOptionOptTa_cee3248c $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class CreateAsTargetWithQualifiedNameOptColumnListTableAccessMethodClauseOptWithOnCommitOptionOptTa_cee3248c implements \SqlSemantics\Statement\Model\PostgreSql\Role\CreateAsTargetForm
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\OptWithForm $optWith,
27 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OnCommitOptionForm $onCommitOption,
28 public readonly \SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace,
29 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
30 ) {
31 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($qualifiedName), 'The qualifiedName must be a generated immutable SQL value.');
32 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optColumnList), 'The optColumnList must be a generated immutable SQL value.');
33 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($tableAccessMethodClause), 'The tableAccessMethodClause must be a generated immutable SQL value.');
34 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optWith), 'The optWith must be a generated immutable SQL value.');
35 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($onCommitOption), 'The onCommitOption must be a generated immutable SQL value.');
36 $this->assert(\SqlSemantics\Statement\Model\PostgreSql\Contract\Contracts::contains($optTableSpace), 'The optTableSpace 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->qualifiedName->write($writer);
46 $writer->comments($this->comments, 1);
47 $this->optColumnList->write($writer);
48 $writer->comments($this->comments, 2);
49 $this->tableAccessMethodClause->write($writer);
50 $writer->comments($this->comments, 3);
51 $this->optWith->write($writer);
52 $writer->comments($this->comments, 4);
53 $this->onCommitOption->write($writer);
54 $writer->comments($this->comments, 5);
55 $this->optTableSpace->write($writer);
56 }
57
58 /**
59 * Returns a copy with a new qualifiedName, preserving every other field.
60 */
61 public function withQualifiedName(\SqlSemantics\Statement\Model\PostgreSql\Role\QualifiedNameForm $qualifiedName): self
62 {
63 return new self($qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optWith, $this->onCommitOption, $this->optTableSpace, $this->comments);
64 }
65
66 /**
67 * Returns a copy with a new optColumnList, preserving every other field.
68 */
69 public function withOptColumnList(\SqlSemantics\Statement\Model\PostgreSql\Role\OptColumnListForm $optColumnList): self
70 {
71 return new self($this->qualifiedName, $optColumnList, $this->tableAccessMethodClause, $this->optWith, $this->onCommitOption, $this->optTableSpace, $this->comments);
72 }
73
74 /**
75 * Returns a copy with a new tableAccessMethodClause, preserving every other field.
76 */
77 public function withTableAccessMethodClause(\SqlSemantics\Statement\Model\PostgreSql\Role\TableAccessMethodClauseForm $tableAccessMethodClause): self
78 {
79 return new self($this->qualifiedName, $this->optColumnList, $tableAccessMethodClause, $this->optWith, $this->onCommitOption, $this->optTableSpace, $this->comments);
80 }
81
82 /**
83 * Returns a copy with a new optWith, preserving every other field.
84 */
85 public function withOptWith(\SqlSemantics\Statement\Model\PostgreSql\Role\OptWithForm $optWith): self
86 {
87 return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $optWith, $this->onCommitOption, $this->optTableSpace, $this->comments);
88 }
89
90 /**
91 * Returns a copy with a new onCommitOption, preserving every other field.
92 */
93 public function withOnCommitOption(\SqlSemantics\Statement\Model\PostgreSql\Role\OnCommitOptionForm $onCommitOption): self
94 {
95 return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optWith, $onCommitOption, $this->optTableSpace, $this->comments);
96 }
97
98 /**
99 * Returns a copy with a new optTableSpace, preserving every other field.
100 */
101 public function withOptTableSpace(\SqlSemantics\Statement\Model\PostgreSql\Role\OptTableSpaceForm $optTableSpace): self
102 {
103 return new self($this->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optWith, $this->onCommitOption, $optTableSpace, $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->qualifiedName, $this->optColumnList, $this->tableAccessMethodClause, $this->optWith, $this->onCommitOption, $this->optTableSpace, $comments);
112 }
113}
114