MCPcopy Create free account
hub / github.com/AfterShip/clickhouse-sql-parser / FormatSQL

Method FormatSQL

parser/format.go:2584–2602  ·  view source on GitHub ↗
(formatter *Formatter)

Source from the content-addressed store, hash-verified

2582}
2583
2584func (a *TableIndex) FormatSQL(formatter *Formatter) {
2585 formatter.WriteString("INDEX")
2586 formatter.WriteByte(whitespace)
2587 formatter.WriteExpr(a.Name)
2588 // Add space only if column expression doesn't start with '('
2589 columnExprStr := Format(a.ColumnExpr)
2590 if len(columnExprStr) > 0 && columnExprStr[0] != '(' {
2591 formatter.WriteByte(whitespace)
2592 }
2593 formatter.WriteString(columnExprStr)
2594 formatter.WriteByte(whitespace)
2595 formatter.WriteString("TYPE")
2596 formatter.WriteByte(whitespace)
2597 formatter.WriteExpr(a.ColumnType)
2598 formatter.WriteByte(whitespace)
2599 formatter.WriteString("GRANULARITY")
2600 formatter.WriteByte(whitespace)
2601 formatter.WriteExpr(a.Granularity)
2602}
2603
2604func (t *TableProjection) FormatSQL(formatter *Formatter) {
2605 if t.IncludeProjectionKeyword {

Callers

nothing calls this directly

Calls 4

FormatFunction · 0.85
WriteStringMethod · 0.80
WriteByteMethod · 0.80
WriteExprMethod · 0.80

Tested by

no test coverage detected