Răsfoiți Sursa

chore: refactor code (#1613)

Kevin Wan 3 ani în urmă
părinte
comite
b939ce75ba
1 a modificat fișierele cu 7 adăugiri și 7 ștergeri
  1. 7 7
      core/stores/builder/builder.go

+ 7 - 7
core/stores/builder/builder.go

@@ -31,20 +31,20 @@ func RawFieldNames(in interface{}, postgresSql ...bool) []string {
 		// gets us a StructField
 		fi := typ.Field(i)
 		tagv := fi.Tag.Get(dbTag)
-		switch {
-		case tagv == "-":
+		switch tagv {
+		case "-":
 			continue
-		case tagv != "":
+		case "":
 			if pg {
-				out = append(out, tagv)
+				out = append(out, fi.Name)
 			} else {
-				out = append(out, fmt.Sprintf("`%s`", tagv))
+				out = append(out, fmt.Sprintf("`%s`", fi.Name))
 			}
 		default:
 			if pg {
-				out = append(out, fi.Name)
+				out = append(out, tagv)
 			} else {
-				out = append(out, fmt.Sprintf("`%s`", fi.Name))
+				out = append(out, fmt.Sprintf("`%s`", tagv))
 			}
 		}
 	}