Joel Nordell 5744e29fbd
Replacer interface for more flexible NamingStrategy (#4042)
* Change NameReplacer to an interface, allowing custom Replacers.

* Add NoLowerCase option to skip the snake_casing of names.

* 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.

* Refactor NamingStrategy tests to add more assertions about how and when Replacers get called.

* Remove the name cache from NamingStrategy.
2021-02-14 08:16:24 +08:00
..
2020-06-02 09:18:01 +08:00
2020-06-02 09:18:01 +08:00
2020-07-04 08:21:23 +08:00
2020-10-21 20:18:21 +08:00
2020-10-21 20:18:21 +08:00
2020-08-27 15:03:57 +08:00
2020-11-10 21:23:20 +08:00