Add support for additional array types.

This commit is contained in:
go-jet 2025-10-16 15:09:07 +02:00
parent 45d4ced9b0
commit 4ee047a675
47 changed files with 1994 additions and 4277 deletions

View file

@ -2,33 +2,24 @@ package postgres
import "github.com/go-jet/jet/v2/internal/jet"
// Expression is common interface for all expressions.
// Expression is a common interface for all expressions.
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.
type Expression = jet.Expression
// BoolExpression interface
type BoolExpression = jet.BoolExpression
// BoolArrayExpression interface
type BoolArrayExpression = jet.ArrayExpression[BoolExpression]
// StringExpression interface
type StringExpression = jet.StringExpression
type ByteaExpression = jet.BlobExpression
// StringArrayExpression interface
type StringArrayExpression = jet.ArrayExpression[StringExpression]
// NumericExpression interface
type NumericExpression = jet.NumericExpression
// IntegerExpression interface
type IntegerExpression = jet.IntegerExpression
// IntegerArrayExpression interface
type IntegerArrayExpression = jet.ArrayExpression[IntegerExpression]
// FloatExpression is interface
type FloatExpression = jet.FloatExpression
@ -185,3 +176,13 @@ var NewEnumValue = jet.NewEnumValue
// BinaryOperator can be used to use custom or unsupported operators that take two operands.
var BinaryOperator = jet.BinaryOperator
// Array is a common template interface for all array expressions.
type Array[T Expression] jet.Array[T]
// ArrayExp serves as a wrapper for an arbitrary expression, treating it as an array expression of type T.
// This enables the Go compiler to interpret any expression as an array expression of type T.
// Note: This does not modify the generated SQL builder output by adding an SQL CAST operation.
func ArrayExp[T Expression](exp Expression) Array[T] {
return jet.ArrayExp[T](exp)
}