mirror of https://github.com/go-gorm/gorm.git
Don't panic with ToDbName
This commit is contained in:
parent
67874f9232
commit
4351917c45
4
utils.go
4
utils.go
|
@ -53,6 +53,10 @@ func ToDBName(name string) string {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if name == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
value = commonInitialismsReplacer.Replace(name)
|
value = commonInitialismsReplacer.Replace(name)
|
||||||
buf = bytes.NewBufferString("")
|
buf = bytes.NewBufferString("")
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
func TestToDBNameGenerateFriendlyName(t *testing.T) {
|
func TestToDBNameGenerateFriendlyName(t *testing.T) {
|
||||||
var maps = map[string]string{
|
var maps = map[string]string{
|
||||||
|
"": "",
|
||||||
"ThisIsATest": "this_is_a_test",
|
"ThisIsATest": "this_is_a_test",
|
||||||
"PFAndESI": "pf_and_esi",
|
"PFAndESI": "pf_and_esi",
|
||||||
"AbcAndJkl": "abc_and_jkl",
|
"AbcAndJkl": "abc_and_jkl",
|
||||||
|
|
Loading…
Reference in New Issue