MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / exprFmtWithParen

Function exprFmtWithParen

pkg/sql/sem/tree/expr.go:123–131  ·  view source on GitHub ↗

exprFmtWithParen is a variant of Format() which adds a set of outer parens if the expression involves an operator. It is used internally when the expression is part of another expression and we know it is preceded or followed by an operator.

(ctx *FmtCtx, e Expr)

Source from the content-addressed store, hash-verified

121// expression is part of another expression and we know it is preceded or
122// followed by an operator.
123func exprFmtWithParen(ctx *FmtCtx, e Expr) {
124 if _, ok := e.(operatorExpr); ok {
125 ctx.WriteByte('(')
126 ctx.FormatNode(e)
127 ctx.WriteByte(')')
128 } else {
129 ctx.FormatNode(e)
130 }
131}
132
133// typeAnnotation is an embeddable struct to provide a TypedExpr with a dynamic
134// type annotation.

Callers 10

binExprFmtWithParenFunction · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85

Calls 1

FormatNodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…