Range types implemented
plus and minus infinity keyword tests implemented range table tests added skip cockroach db added select test case added for range fields generator modified to generate correct types generator tests modified to include sample range table model and template generators modified to support range fields returning the T in UPPER and LOWER functions raw ranges implemented bounds set as optional dep modified dependencies modified and issue fixed range expression with templates implemented rangeExpression change to make it more type safe third parameter of constructor function fixed literals removed, functions added tests modified constructor functions used for creating range expressions NumRange converted to a constructor function from literal range_lower and range_upper renamed to lower_bound and upper_bound range literal removed PlusInfinity and MinusInfinity implemented int4 and int8 castings added issues fixed and tests checked number, ts, tstz literal and cast implemented date range literal expression modified and raw function used parent type converted from RangeExpression to Expression range type implemented for postgres range column type, function and literal expression implemented CONTAINS and OVERLAP operations added for range expressions range expressions implemented
This commit is contained in:
parent
a9cbf94d68
commit
893567daca
20 changed files with 1062 additions and 19 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/generator/metadata"
|
||||
"github.com/go-jet/jet/v2/internal/utils/dbidentifier"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgtype"
|
||||
"path"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
@ -320,6 +321,18 @@ func toGoType(column metadata.Column) interface{} {
|
|||
return float64(0.0)
|
||||
case "uuid":
|
||||
return uuid.UUID{}
|
||||
case "daterange":
|
||||
return pgtype.Daterange{}
|
||||
case "tsrange":
|
||||
return pgtype.Tsrange{}
|
||||
case "tstzrange":
|
||||
return pgtype.Tstzrange{}
|
||||
case "int4range":
|
||||
return pgtype.Int4range{}
|
||||
case "int8range":
|
||||
return pgtype.Int8range{}
|
||||
case "numrange":
|
||||
return pgtype.Numrange{}
|
||||
default:
|
||||
fmt.Println("- [Model ] Unsupported sql column '" + column.Name + " " + column.DataType.Name + "', using string instead.")
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -177,6 +177,18 @@ func getSqlBuilderColumnType(columnMetaData metadata.Column) string {
|
|||
case "real", "numeric", "decimal", "double precision", "float", "float4", "float8",
|
||||
"double": // MySQL
|
||||
return "Float"
|
||||
case "daterange":
|
||||
return "DateRange"
|
||||
case "tsrange":
|
||||
return "TimestampRange"
|
||||
case "tstzrange":
|
||||
return "TimestampzRange"
|
||||
case "int4range":
|
||||
return "Int4Range"
|
||||
case "int8range":
|
||||
return "Int8Range"
|
||||
case "numrange":
|
||||
return "NumericRange"
|
||||
default:
|
||||
fmt.Println("- [SQL Builder] Unsupported sql column '" + columnMetaData.Name + " " + columnMetaData.DataType.Name + "', using StringColumn instead.")
|
||||
return "String"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue