mirror of https://github.com/go-gorm/gorm.git
cache converted name (#3736)
BenchmarkToName-8 2322307 521 ns/op 88 B/op 5 allocs/op ↓ BenchmarkToName-8 19997366 55.0 ns/op 0 B/op 0 allocs/op
This commit is contained in:
parent
a9f54d53fb
commit
a4c0c6b400
|
@ -95,7 +95,7 @@ func toDBName(name string) string {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return ""
|
return ""
|
||||||
} else if v, ok := smap.Load(name); ok {
|
} else if v, ok := smap.Load(name); ok {
|
||||||
return fmt.Sprint(v)
|
return v.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -134,6 +134,7 @@ func toDBName(name string) string {
|
||||||
} else {
|
} else {
|
||||||
buf.WriteByte(value[len(value)-1])
|
buf.WriteByte(value[len(value)-1])
|
||||||
}
|
}
|
||||||
|
ret := buf.String()
|
||||||
return buf.String()
|
smap.Store(name, ret)
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue