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

Method FormatSQL

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

Source from the content-addressed store, hash-verified

144}
145
146func (p *BinaryOperation) FormatSQL(formatter *Formatter) {
147 if p.isLogicalOp() && formatter.mode == FormatModeBeautify {
148 p.writeLogicalOperand(formatter, p.LeftExpr)
149 formatter.NewLine()
150 if p.HasNot {
151 formatter.WriteString("NOT ")
152 } else if p.HasGlobal {
153 formatter.WriteString("GLOBAL ")
154 }
155 formatter.WriteString(string(p.Operation))
156 formatter.NewLine()
157 p.writeLogicalOperand(formatter, p.RightExpr)
158 return
159 }
160 formatter.WriteExpr(p.LeftExpr)
161 if p.Operation != TokenKindDash {
162 formatter.WriteByte(whitespace)
163 }
164 if p.HasNot {
165 formatter.WriteString("NOT ")
166 } else if p.HasGlobal {
167 formatter.WriteString("GLOBAL ")
168 }
169 formatter.WriteString(string(p.Operation))
170 if p.Operation != TokenKindDash {
171 formatter.WriteByte(whitespace)
172 }
173 formatter.WriteExpr(p.RightExpr)
174}
175
176func (a *AliasExpr) FormatSQL(formatter *Formatter) {
177 if _, isSelect := a.Expr.(*SelectQuery); isSelect {

Callers

nothing calls this directly

Calls 6

isLogicalOpMethod · 0.95
writeLogicalOperandMethod · 0.95
NewLineMethod · 0.80
WriteStringMethod · 0.80
WriteExprMethod · 0.80
WriteByteMethod · 0.80

Tested by

no test coverage detected