diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index 7cda1b7c2b..0e0757daf8 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -302,15 +302,15 @@ func ydbBuilderMethodForColumnType(dbType string) string { return "Bool" case "uint64": return "Uint64" - case "int64": + case "int64", "bigserial", "serial8": return "Int64" case "uint32": return "Uint32" - case "int32": + case "int32", "serial", "serial4": return "Int32" case "uint16": return "Uint16" - case "int16": + case "int16", "smallserial","serial2": return "Int16" case "uint8": return "Uint8" @@ -340,6 +340,10 @@ func ydbBuilderMethodForColumnType(dbType string) string { return "TzDatetime" case "tztimestamp": return "TzTimestamp" + case "uuid": + return "UUID" + case "yson": + return "YSON" //TODO: support other types default: diff --git a/internal/codegen/golang/ydb_type.go b/internal/codegen/golang/ydb_type.go index 0ef665aee1..fc3e5d01da 100644 --- a/internal/codegen/golang/ydb_type.go +++ b/internal/codegen/golang/ydb_type.go @@ -49,7 +49,7 @@ func YDBType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Col } // return "sql.NullInt16" return "*int16" - case "int", "int32": //ydb doesn't have int type, but we need it to support untyped constants + case "int", "int32": //ydb doesn't have int type, but we need it to support untyped constants if notNull { return "int32" } @@ -159,7 +159,7 @@ func YDBType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Col return "*string" } return "*string" - + case "date", "date32", "datetime", "timestamp", "tzdate", "tztimestamp", "tzdatetime": if notNull { return "time.Time" @@ -169,6 +169,24 @@ func YDBType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Col } return "*time.Time" + case "uuid": + if notNull { + return "uuid.UUID" + } + if emitPointersForNull { + return "*uuid.UUID" + } + return "*uuid.UUID" + + case "yson": + if notNull { + return "[]byte" + } + if emitPointersForNull { + return "*[]byte" + } + return "*[]byte" + case "null": // return "sql.Null" return "interface{}"