-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use pkg name in tableMap for unique cache keys (#479)
When using two structs from different packages where both structs have the same name as models, the `tableMap` would incorrectly set up as only the struct's name is used as the cache key. This patch uses the package path and the struct name to generate unique cache keys across go projects. Closes #477 Signed-off-by: aeneasr <[email protected]>
- Loading branch information
1 parent
11bd52a
commit d9c4e3c
Showing
5 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ type mockTranslator struct{} | |
|
||
func (mockTranslator) Name() string { | ||
return "test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package a | ||
|
||
type User struct{} | ||
|
||
func (u User) TableName() string { | ||
return "usera" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package b | ||
|
||
type User struct{} | ||
|
||
func (u User) TableName() string { | ||
return "userb" | ||
} |