Skip to content

Commit e18a59a

Browse files
committed
assoc ignore gorm:"-"
1 parent c2673b5 commit e18a59a

File tree

2 files changed

+6
-36
lines changed

2 files changed

+6
-36
lines changed

ChangeLog.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

gorm/fields.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ func tidySubPreload(subs map[string]*query.Field, objType reflect.Type, subPrelo
8585
exists[sp[0]] = e
8686
}
8787

88-
_, nf := subs["_assoc"]
89-
if nf {
88+
_, assoc := subs["_assoc"]
89+
if assoc {
9090
numField := objType.NumField()
9191
for i := 0; i < numField; i++ {
9292
sf := objType.Field(i)
@@ -97,6 +97,10 @@ func tidySubPreload(subs map[string]*query.Field, objType reflect.Type, subPrelo
9797

9898
fType := indirectType(sf.Type)
9999
if isModel(fType) {
100+
if ok, _ := gormTag(&sf, "-"); ok {
101+
continue
102+
}
103+
100104
exists[sf.Name] = sf.Name
101105
edited = true
102106
}

0 commit comments

Comments
 (0)