Add support for Row expression.

This commit is contained in:
go-jet 2024-10-06 14:21:42 +02:00
parent 58a386a3dd
commit 3fcbbec427
16 changed files with 254 additions and 63 deletions

View file

@ -36,6 +36,9 @@ type TimestampExpression = jet.TimestampExpression
// TimestampzExpression interface
type TimestampzExpression = jet.TimestampzExpression
// RowExpression interface
type RowExpression = jet.RowExpression
// DateRange Expression interface
type DateRange = jet.Range[DateExpression]
@ -99,6 +102,11 @@ var TimestampExp = jet.TimestampExp
// Does not add sql cast to generated sql builder output.
var TimestampzExp = jet.TimestampzExp
// RowExp serves as a wrapper for an arbitrary expression, treating it as a row expression.
// This enables the Go compiler to interpret any expression as a row expression
// Note: This does not modify the generated SQL builder output by adding a SQL CAST operation.
var RowExp = jet.RowExp
// RangeExp is range expression wrapper around arbitrary expression.
// Allows go compiler to see any expression as range expression.
// Does not add sql cast to generated sql builder output.

View file

@ -57,6 +57,16 @@ func Uint64(value uint64) IntegerExpression {
// Float creates new float literal expression
var Float = jet.Float
// Float32 is constructor for 32 bit float literals
func Float32(value float32) FloatExpression {
return CAST(jet.Literal(value)).AS_REAL()
}
// Float64 is constructor for 64 bit float literals
func Float64(value float64) FloatExpression {
return CAST(jet.Literal(value)).AS_DOUBLE()
}
// Decimal creates new float literal expression
var Decimal = jet.Decimal