feat(merge): enhance type conflict detection for columns

* Introduced extractTypeParts function to handle embedded dimensions in type strings.
* Updated columnTypeConflict to utilize new type extraction logic.
* Improved PostgreSQL type normalization and handling in various components.
This commit is contained in:
2026-05-19 19:12:27 +02:00
parent 9235ef5e08
commit 9190df81dd
6 changed files with 141 additions and 110 deletions
+5 -15
View File
@@ -5,6 +5,8 @@ import (
"regexp"
"strings"
"unicode"
"git.warky.dev/wdevs/relspecgo/pkg/pgsql"
)
// TemplateFunctions returns a map of custom template functions
@@ -162,24 +164,12 @@ func quoteIdent(s string) string {
// Type conversion functions
// goTypeToSQL converts Go type to PostgreSQL type
// goTypeToSQL converts Go type to PostgreSQL type using the shared pgsql type map.
func goTypeToSQL(goType string) string {
typeMap := map[string]string{
"string": "text",
"int": "integer",
"int32": "integer",
"int64": "bigint",
"float32": "real",
"float64": "double precision",
"bool": "boolean",
"time.Time": "timestamp",
"[]byte": "bytea",
}
if sqlType, ok := typeMap[goType]; ok {
if sqlType, ok := pgsql.GoToPGSQLTypes[goType]; ok {
return sqlType
}
return "text" // Default
return "text"
}
// sqlTypeToGo converts PostgreSQL type to Go type