From 60760b52ab1b6ef649d21a765203926f35148c0b Mon Sep 17 00:00:00 2001 From: Javen <306287405@qq.com> Date: Fri, 4 Mar 2022 17:00:46 +0800 Subject: [PATCH] =?UTF-8?q?model=E4=B8=ADdb=E6=A0=87=E7=AD=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0'-'=E7=AC=A6=E5=8F=B7=E4=BB=A5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=E6=97=B6=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E5=AF=B9=E5=BA=94=E5=AD=97=E6=AE=B5.=20(#1612)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/stores/builder/builder.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/stores/builder/builder.go b/core/stores/builder/builder.go index d2fe5cc7..8c731ae5 100644 --- a/core/stores/builder/builder.go +++ b/core/stores/builder/builder.go @@ -30,13 +30,17 @@ func RawFieldNames(in interface{}, postgresSql ...bool) []string { for i := 0; i < v.NumField(); i++ { // gets us a StructField fi := typ.Field(i) - if tagv := fi.Tag.Get(dbTag); tagv != "" { + tagv := fi.Tag.Get(dbTag) + switch { + case tagv == "-": + continue + case tagv != "": if pg { out = append(out, tagv) } else { out = append(out, fmt.Sprintf("`%s`", tagv)) } - } else { + default: if pg { out = append(out, fi.Name) } else {