forked from mirror/gorm
fix spelling mistake (#5256)
Co-authored-by: Shenao Zhang <shenao.zhang@shopee.com>
This commit is contained in:
parent
d421c67ef5
commit
e0ed3ce400
|
@ -125,7 +125,7 @@ func checkMissingWhereConditions(db *gorm.DB) {
|
||||||
type visitMap = map[reflect.Value]bool
|
type visitMap = map[reflect.Value]bool
|
||||||
|
|
||||||
// Check if circular values, return true if loaded
|
// Check if circular values, return true if loaded
|
||||||
func loadOrStoreVisitMap(vistMap *visitMap, v reflect.Value) (loaded bool) {
|
func loadOrStoreVisitMap(visitMap *visitMap, v reflect.Value) (loaded bool) {
|
||||||
if v.Kind() == reflect.Ptr {
|
if v.Kind() == reflect.Ptr {
|
||||||
v = v.Elem()
|
v = v.Elem()
|
||||||
}
|
}
|
||||||
|
@ -134,17 +134,17 @@ func loadOrStoreVisitMap(vistMap *visitMap, v reflect.Value) (loaded bool) {
|
||||||
case reflect.Slice, reflect.Array:
|
case reflect.Slice, reflect.Array:
|
||||||
loaded = true
|
loaded = true
|
||||||
for i := 0; i < v.Len(); i++ {
|
for i := 0; i < v.Len(); i++ {
|
||||||
if !loadOrStoreVisitMap(vistMap, v.Index(i)) {
|
if !loadOrStoreVisitMap(visitMap, v.Index(i)) {
|
||||||
loaded = false
|
loaded = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case reflect.Struct, reflect.Interface:
|
case reflect.Struct, reflect.Interface:
|
||||||
if v.CanAddr() {
|
if v.CanAddr() {
|
||||||
p := v.Addr()
|
p := v.Addr()
|
||||||
if _, ok := (*vistMap)[p]; ok {
|
if _, ok := (*visitMap)[p]; ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
(*vistMap)[p] = true
|
(*visitMap)[p] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue