perf: use strings.Cut to replace strings.SplitN (#7455)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
This commit is contained in:
parent
e5b867e785
commit
1c966e0d25
@ -103,11 +103,11 @@ func preloadEntryPoint(db *gorm.DB, joins []string, relationships *schema.Relati
|
|||||||
joined = true
|
joined = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
joinNames := strings.SplitN(join, ".", 2)
|
join0, join1, cut := strings.Cut(join, ".")
|
||||||
if len(joinNames) == 2 {
|
if cut {
|
||||||
if _, ok := relationships.Relations[joinNames[0]]; ok && name == joinNames[0] {
|
if _, ok := relationships.Relations[join0]; ok && name == join0 {
|
||||||
joined = true
|
joined = true
|
||||||
nestedJoins = append(nestedJoins, joinNames[1])
|
nestedJoins = append(nestedJoins, join1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user