7 Commits

Author SHA1 Message Date
Joel Nordell
4d33b2f584
Move sync.Map from global variable into member of NamingStrategy.
This maintains backward compatibility by making the smap optional - the
NamingStrategy still works if it is nil. gorm.Open activates it by
calling Init() if the given Namer is a schema.NamingStrategy.

Also, this changes the key stored in the smap to be the original name,
instead of the replaced name.
2021-02-08 10:52:06 -06:00
Joel Nordell
96fe56218b
Add NoLowerCase option to skip the snake_casing of names. 2021-02-02 16:32:01 -06:00
Joel Nordell
2abab3cf60
Change NameReplacer to an interface, allowing custom Replacers. 2021-02-02 16:22:02 -06:00
Jinzhu
66e8a72bf1 Support NameReplace for NamingStrategy, close #3779 2020-11-23 11:24:07 +08:00
Jinzhu
a2faa41cbe Refactor NamingStrategy, close #3540 2020-09-28 10:55:27 +08:00
Jinzhu
1a526e6802 Fix NamingStrategy with embedded struct, close #3513 2020-09-24 11:32:38 +08:00
Jinzhu
bc68fde6aa Implement naming strategy 2020-01-31 14:17:02 +08:00