MCPcopy Create free account
hub / github.com/rilldata/rill / writeExpression

Method writeExpression

runtime/metricsview/astexpr.go:43–60  ·  view source on GitHub ↗

writeExpression writes the SQL expression for the given expression. The output is guaranteed to be wrapped in parentheses.

(e *Expression)

Source from the content-addressed store, hash-verified

41// writeExpression writes the SQL expression for the given expression.
42// The output is guaranteed to be wrapped in parentheses.
43func (b *sqlExprBuilder) writeExpression(e *Expression) error {
44 if e == nil {
45 return nil
46 }
47 if e.Name != "" {
48 return b.writeName(e.Name)
49 }
50 if e.Value != nil {
51 return b.writeValue(e.Value)
52 }
53 if e.Subquery != nil {
54 return b.writeSubquery(e.Subquery)
55 }
56 if e.Condition != nil {
57 return b.writeCondition(e.Condition)
58 }
59 return errors.New("invalid expression (must contain one of name, val, cond, subquery)")
60}
61
62func (b *sqlExprBuilder) writeName(name string) error {
63 expr, unnest, _, err := b.sqlForName(name)

Callers 7

SQLForExpressionMethod · 0.95
writeCastMethod · 0.95
writeILikeConditionMethod · 0.95
writeInConditionMethod · 0.95

Calls 4

writeNameMethod · 0.95
writeValueMethod · 0.95
writeSubqueryMethod · 0.95
writeConditionMethod · 0.95

Tested by

no test coverage detected