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 == "" {
|
||||
return ""
|
||||
} else if v, ok := smap.Load(name); ok {
|
||||
return fmt.Sprint(v)
|
||||
return v.(string)
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -134,6 +134,7 @@ func toDBName(name string) string {
|
|||
} else {
|
||||
buf.WriteByte(value[len(value)-1])
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
ret := buf.String()
|
||||
smap.Store(name, ret)
|
||||
return ret
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue