Skip to content

Commit a69429c

Browse files
authored
Added simple types in param builder and ydbType (#14)
1 parent a680b1b commit a69429c

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

internal/codegen/golang/query.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,15 @@ func ydbBuilderMethodForColumnType(dbType string) string {
304304
return "Bool"
305305
case "uint64":
306306
return "Uint64"
307-
case "int64":
307+
case "int64", "bigserial", "serial8":
308308
return "Int64"
309309
case "uint32":
310310
return "Uint32"
311-
case "int32":
311+
case "int32", "serial", "serial4":
312312
return "Int32"
313313
case "uint16":
314314
return "Uint16"
315-
case "int16":
315+
case "int16", "smallserial","serial2":
316316
return "Int16"
317317
case "uint8":
318318
return "Uint8"
@@ -342,6 +342,10 @@ func ydbBuilderMethodForColumnType(dbType string) string {
342342
return "TzDatetime"
343343
case "tztimestamp":
344344
return "TzTimestamp"
345+
case "uuid":
346+
return "UUID"
347+
case "yson":
348+
return "YSON"
345349

346350
//TODO: support other types
347351
default:

internal/codegen/golang/ydb_type.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,24 @@ func YDBType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Col
171171
}
172172
return "*time.Time"
173173

174+
case "uuid":
175+
if notNull {
176+
return "uuid.UUID"
177+
}
178+
if emitPointersForNull {
179+
return "*uuid.UUID"
180+
}
181+
return "*uuid.UUID"
182+
183+
case "yson":
184+
if notNull {
185+
return "[]byte"
186+
}
187+
if emitPointersForNull {
188+
return "*[]byte"
189+
}
190+
return "*[]byte"
191+
174192
case "null":
175193
// return "sql.Null"
176194
return "interface{}"

0 commit comments

Comments
 (0)