MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / renderIn

Function renderIn

pkg/formatter/render.go:1109–1136  ·  view source on GitHub ↗
(i *ast.InExpression, opts ast.FormatOptions)

Source from the content-addressed store, hash-verified

1107}
1108
1109func renderIn(i *ast.InExpression, opts ast.FormatOptions) string {
1110 if i == nil {
1111 return ""
1112 }
1113 f := newNodeFormatter(opts)
1114 sb := f.sb
1115
1116 sb.WriteString(FormatExpression(i.Expr, opts))
1117 sb.WriteString(" ")
1118 if i.Not {
1119 sb.WriteString(f.kw("NOT"))
1120 sb.WriteString(" ")
1121 }
1122 sb.WriteString(f.kw("IN"))
1123 sb.WriteString(" (")
1124 if i.Subquery != nil {
1125 sb.WriteString(FormatStatement(i.Subquery, opts))
1126 } else {
1127 parts := make([]string, len(i.List))
1128 for idx, e := range i.List {
1129 parts[idx] = FormatExpression(e, opts)
1130 }
1131 sb.WriteString(strings.Join(parts, ", "))
1132 }
1133 sb.WriteString(")")
1134
1135 return f.result()
1136}
1137
1138func renderExists(e *ast.ExistsExpression, opts ast.FormatOptions) string {
1139 if e == nil {

Callers 1

FormatExpressionFunction · 0.85

Calls 5

newNodeFormatterFunction · 0.85
FormatExpressionFunction · 0.85
FormatStatementFunction · 0.85
kwMethod · 0.80
resultMethod · 0.80

Tested by

no test coverage detected