Joel Nordell
8c0c82e887
Remove the name cache from NamingStrategy.
2021-02-10 11:14:21 -06:00
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
db0cc4d60b
Fix too long foreign key/checker names, close #4026
2021-02-01 10:37:12 +08:00
Jinzhu
66e8a72bf1
Support NameReplace for NamingStrategy, close #3779
2020-11-23 11:24:07 +08:00
alresvor
a4c0c6b400
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
2020-11-16 15:16:15 +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
6e38a2c2d5
Fix many2many join table name rule
2020-09-06 10:51:21 +08:00
Jinzhu
2d048d9ece
SingularTable for JoinTable
2020-06-30 07:29:15 +08:00
Jinzhu
fee1e4aafd
Fix create foreign keys for many2many relations
2020-06-21 10:48:23 +08:00
Jinzhu
5790ba9ef4
Fix package path
2020-06-02 09:25:55 +08:00
Jinzhu
e986371a42
Rename package name
2020-06-02 09:18:01 +08:00
Jinzhu
6d58b62fd4
Add sqlite migration tests
2020-02-22 20:57:29 +08:00
Jinzhu
0be4817ff9
Finish CreateConstraint
2020-02-22 11:15:51 +08:00
Jinzhu
ad419855e9
Parse Indexes
2020-02-21 23:51:38 +08:00
Jinzhu
3cbd233758
Add more tests for parse schema relations
2020-02-02 00:03:56 +08:00
Jinzhu
fd9b688084
Implement parse many2many relation
2020-02-01 18:02:19 +08:00
Jinzhu
eea78f3f30
Implement parse relationship architecture
2020-02-01 12:46:52 +08:00
Jinzhu
bc68fde6aa
Implement naming strategy
2020-01-31 14:17:02 +08:00