Created
June 21, 2019 11:09
-
-
Save chris001177/1fba963722485475dd4bf9b84ecf7c16 to your computer and use it in GitHub Desktop.
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
package definition | |
// Note that in this approach both the singleton instance | |
// and its interface type are declared in the definition | |
// package. Make sure this package does not contain any | |
// logic, otherwise it might need to import other packages | |
// and its neutral nature is compromised. | |
var ( | |
UserDBInstance UserDB | |
ConfigDBInstance ConfigDB | |
) | |
type UserDB interface { | |
UserRoleByID(id string) string | |
} | |
type ConfigDB interface { | |
AllPermissions() map[string][]string // maps from role to its permissions | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment