Simplify construction of new expressions.

Fixes: IS_NOT_NULL() does not always add enough parentheses to the compiled SQL #500
This commit is contained in:
go-jet 2026-02-02 13:18:19 +01:00
parent 95224a793f
commit 4995a90483
26 changed files with 466 additions and 543 deletions

View file

@ -552,10 +552,10 @@ func DATE_TRUNC(field unit, source Expression, timezone ...string) TimestampExpr
// GENERATE_SERIES generates a series of values from start to stop, with a step size of step.
func GENERATE_SERIES(start Expression, stop Expression, step ...Expression) Expression {
if len(step) > 0 {
return jet.NewFunc("GENERATE_SERIES", []Expression{start, stop, step[0]}, nil)
return Func("GENERATE_SERIES", start, stop, step[0])
}
return jet.NewFunc("GENERATE_SERIES", []Expression{start, stop}, nil)
return Func("GENERATE_SERIES", start, stop)
}
// --------------- Conditional Expressions Functions -------------//