From 34a5f3393751594a492a24651bd8c9639362cd88 Mon Sep 17 00:00:00 2001 From: zodial Date: Mon, 23 Sep 2024 11:00:37 +0800 Subject: [PATCH] =?UTF-8?q?update:=20pgsql=E7=9A=84=E7=B1=BB=E5=9E=8Bbytea?= =?UTF-8?q?=E5=9C=A8go=E6=94=B9=E4=B8=BA[]byte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/commands/pgorm/pgsql.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/console/commands/pgorm/pgsql.go b/console/commands/pgorm/pgsql.go index efcb3b1..21ebbd6 100644 --- a/console/commands/pgorm/pgsql.go +++ b/console/commands/pgorm/pgsql.go @@ -254,7 +254,7 @@ func genOrmStruct(table string, columns []tableColumn, conf Conf, relationships str := `type {TableName} struct {` for _, column := range columns { p := "" - if column.IsNullable && !(column.ColumnName == "deleted_at" && column.GoType == "database.Time") { + if column.IsNullable && !(column.ColumnName == "deleted_at" && column.GoType == "database.Time") && column.PgType != "bytea" { p = "*" } if column.ColumnName == "deleted_at" && column.GoType == "database.Time" { @@ -518,6 +518,8 @@ func PgTypeToGoType(pgType string, columnName string) string { return "database.Time" case "numeric": return "float64" + case "bytea": + return "[]byte" default: if strings.Contains(pgType, "timestamp") { if columnName == "deleted_at" {