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

@ -2,10 +2,11 @@ package mysql
import (
"fmt"
"github.com/go-jet/jet/v2/internal/utils/datetime"
"regexp"
"time"
"github.com/go-jet/jet/v2/internal/utils/datetime"
"github.com/go-jet/jet/v2/internal/jet"
)
@ -98,7 +99,7 @@ func INTERVAL(value interface{}, unitType unitType) Interval {
// INTERVALe creates new temporal interval from expresion and unit type.
func INTERVALe(expr Expression, unitType unitType) Interval {
return jet.IntervalExp(CustomExpression(Token("INTERVAL"), expr, Token(unitType)))
return jet.IntervalExp(jet.AtomicCustomExpression(Token("INTERVAL"), expr, Token(unitType)))
}
// INTERVALd creates new temporal interval from time.Duration