refactor: expose NewCustomExpression for dialects to use

This commit is contained in:
Mathieu Kooiman 2024-07-12 14:09:17 +02:00
parent 093f895db2
commit f48970d124
3 changed files with 3 additions and 3 deletions

View file

@ -278,7 +278,7 @@ type customExpression struct {
parts []Serializer
}
func newCustomExpression(parts ...Serializer) Expression {
func NewCustomExpression(parts ...Serializer) Expression {
ret := customExpression{
parts: parts,
}

View file

@ -548,7 +548,7 @@ func TO_TIMESTAMP(timestampzStr, format StringExpression) TimestampzExpression {
// EXTRACT extracts time component from time expression
func EXTRACT(field string, from Expression) Expression {
return newCustomExpression(Token("EXTRACT("), Token(field), Token("FROM"), from, Token(")"))
return NewCustomExpression(Token("EXTRACT("), Token(field), Token("FROM"), from, Token(")"))
}
// CURRENT_DATE returns current date

View file

@ -35,7 +35,7 @@ func GROUPING(expressions ...Expression) IntegerExpression {
// WITH_ROLLUP operator is used with the GROUP BY clause to generate all prefixes of a group of columns including the empty list.
// It creates extra rows in the result set that represent the subtotal values for each combination of columns.
func WITH_ROLLUP(expressions ...Expression) GroupByClause {
return newCustomExpression(
return NewCustomExpression(
parametersSerializer(expressions), Token("WITH ROLLUP"),
)
}