Merge pull request #361 from mathieuk/chore/export-serializer
feat: export CustomExpression and Token for dialects to use
This commit is contained in:
commit
df548e69b6
6 changed files with 21 additions and 3 deletions
|
|
@ -278,7 +278,7 @@ type customExpression struct {
|
|||
parts []Serializer
|
||||
}
|
||||
|
||||
func newCustomExpression(parts ...Serializer) Expression {
|
||||
func CustomExpression(parts ...Serializer) Expression {
|
||||
ret := customExpression{
|
||||
parts: parts,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 CustomExpression(Token("EXTRACT("), Token(field), Token("FROM"), from, Token(")"))
|
||||
}
|
||||
|
||||
// CURRENT_DATE returns current date
|
||||
|
|
|
|||
|
|
@ -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 CustomExpression(
|
||||
parametersSerializer(expressions), Token("WITH ROLLUP"),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ var DateTimeExp = jet.TimestampExp
|
|||
// Does not add sql cast to generated sql builder output.
|
||||
var TimestampExp = jet.TimestampExp
|
||||
|
||||
// CustomExpression is used to define custom expressions.
|
||||
var CustomExpression = jet.CustomExpression
|
||||
|
||||
// Token is used to define custom token in a custom expression.
|
||||
type Token = jet.Token
|
||||
|
||||
// RawArgs is type used to pass optional arguments to Raw method
|
||||
type RawArgs = map[string]interface{}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,12 @@ var (
|
|||
TstzRangeExp = jet.TstzRangeExp
|
||||
)
|
||||
|
||||
// CustomExpression is used to define custom expressions.
|
||||
var CustomExpression = jet.CustomExpression
|
||||
|
||||
// Token is used to define custom token in a custom expression.
|
||||
type Token = jet.Token
|
||||
|
||||
// RawArgs is type used to pass optional arguments to Raw method
|
||||
type RawArgs = map[string]interface{}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,12 @@ var DateTimeExp = jet.TimestampExp
|
|||
// Does not add sql cast to generated sql builder output.
|
||||
var TimestampExp = jet.TimestampExp
|
||||
|
||||
// CustomExpression is used to define custom expressions.
|
||||
var CustomExpression = jet.CustomExpression
|
||||
|
||||
// Token is used to define custom token in a custom expression.
|
||||
type Token = jet.Token
|
||||
|
||||
// RawArgs is type used to pass optional arguments to Raw method
|
||||
type RawArgs = map[string]interface{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue