From 99fe0a6bc387121769edfd9fdb7b74a7117f3ad2 Mon Sep 17 00:00:00 2001 From: Qishuai Liu Date: Thu, 3 Aug 2023 18:16:59 +0900 Subject: [PATCH] add "year" and "uuid" types --- generator/generator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generator/generator.go b/generator/generator.go index 9365312..ed7b748 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -88,9 +88,13 @@ func getType(fieldDescriptor fieldDescriptor) (goType string, fieldClass string, case "float", "double", "decimal", "real": goType = "float64" fieldClass = "NumberField" - case "char", "varchar", "text", "tinytext", "mediumtext", "longtext", "enum", "datetime", "date", "time", "timestamp", "json", "numeric", "character varying", "timestamp without time zone", "timestamp with time zone", "jsonb": + case "char", "varchar", "text", "tinytext", "mediumtext", "longtext", "enum", "datetime", "date", "time", "timestamp", "json", "numeric", "character varying", "timestamp without time zone", "timestamp with time zone", "jsonb", "uuid": goType = "string" fieldClass = "StringField" + case "year": + goType = "int16" + fieldClass = "NumberField" + fieldDescriptor.Unsigned = true case "binary", "varbinary", "blob", "tinyblob", "mediumblob", "longblob": // TODO: use []byte ? goType = "string"