Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions internal/codegen/golang/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing after commas ("smallserial","serial2") compared to other multi-value case lines; add a space after the comma for readability and consistency: case "int16", "smallserial", "serial2":.

Suggested change
case "int16", "smallserial","serial2":
case "int16", "smallserial", "serial2":

Copilot uses AI. Check for mistakes.

return "Int16"
case "uint8":
return "Uint8"
Expand Down Expand Up @@ -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:
Expand Down
22 changes: 20 additions & 2 deletions internal/codegen/golang/ydb_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Comment on lines +172 to +188
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second conditional in each block is redundant because both the conditional branch and the final return produce the same value; this can be simplified to reduce noise. Suggest rewriting each to only check notNull, then return the pointer form unconditionally for the nullable case, e.g.: case "uuid": if notNull { return "uuid.UUID" }; return "*uuid.UUID".

Copilot uses AI. Check for mistakes.


case "null":
// return "sql.Null"
return "interface{}"
Expand Down
Loading