writeSequenceOptionsFormatted appends formatted sequence options to the builder. It mirrors the logic in ast/sql.go writeSequenceOptions but uses the nodeFormatter for keyword casing.
(sb *strings.Builder, opts ast.SequenceOptions, f *nodeFormatter)
| 123 | // It mirrors the logic in ast/sql.go writeSequenceOptions but uses the nodeFormatter |
| 124 | // for keyword casing. |
| 125 | func writeSequenceOptionsFormatted(sb *strings.Builder, opts ast.SequenceOptions, f *nodeFormatter) { |
| 126 | if opts.StartWith != nil { |
| 127 | sb.WriteString(" ") |
| 128 | sb.WriteString(f.kw("START WITH")) |
| 129 | sb.WriteString(" ") |
| 130 | sb.WriteString(opts.StartWith.TokenLiteral()) |
| 131 | } |
| 132 | if opts.IncrementBy != nil { |
| 133 | sb.WriteString(" ") |
| 134 | sb.WriteString(f.kw("INCREMENT BY")) |
| 135 | sb.WriteString(" ") |
| 136 | sb.WriteString(opts.IncrementBy.TokenLiteral()) |
| 137 | } |
| 138 | if opts.MinValue != nil { |
| 139 | sb.WriteString(" ") |
| 140 | sb.WriteString(f.kw("MINVALUE")) |
| 141 | sb.WriteString(" ") |
| 142 | sb.WriteString(opts.MinValue.TokenLiteral()) |
| 143 | } |
| 144 | if opts.MaxValue != nil { |
| 145 | sb.WriteString(" ") |
| 146 | sb.WriteString(f.kw("MAXVALUE")) |
| 147 | sb.WriteString(" ") |
| 148 | sb.WriteString(opts.MaxValue.TokenLiteral()) |
| 149 | } |
| 150 | if opts.Cache != nil { |
| 151 | sb.WriteString(" ") |
| 152 | sb.WriteString(f.kw("CACHE")) |
| 153 | sb.WriteString(" ") |
| 154 | sb.WriteString(opts.Cache.TokenLiteral()) |
| 155 | } else if opts.NoCache { |
| 156 | sb.WriteString(" ") |
| 157 | sb.WriteString(f.kw("NOCACHE")) |
| 158 | } |
| 159 | switch opts.CycleMode { |
| 160 | case ast.CycleBehavior: |
| 161 | sb.WriteString(" ") |
| 162 | sb.WriteString(f.kw("CYCLE")) |
| 163 | case ast.NoCycleBehavior: |
| 164 | sb.WriteString(" ") |
| 165 | sb.WriteString(f.kw("NOCYCLE")) |
| 166 | } |
| 167 | if opts.RestartWith != nil { |
| 168 | sb.WriteString(" ") |
| 169 | sb.WriteString(f.kw("RESTART WITH")) |
| 170 | sb.WriteString(" ") |
| 171 | sb.WriteString(opts.RestartWith.TokenLiteral()) |
| 172 | } else if opts.Restart { |
| 173 | sb.WriteString(" ") |
| 174 | sb.WriteString(f.kw("RESTART")) |
| 175 | } |
| 176 | } |
no test coverage detected