Last active
January 19, 2020 06:16
-
-
Save mkock/81776ce725d7962aa15c42626363dcd2 to your computer and use it in GitHub Desktop.
Lookup functions before refactoring
This file contains hidden or 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
| // FindPlayerByID returns the player with the given ID, if exists. | |
| // Otherwise, an empty Player is returned. | |
| func FindPlayerByID(ID uint32) Player { | |
| if p, ok := playerIDMap[ID]; ok { | |
| return p | |
| } | |
| return Player{} | |
| } | |
| // FindPlayerByHandle returns the player with the given Handle, | |
| // if exists. Otherwise, an empty Player is returned. | |
| func FindPlayerByHandle(handle string) Player { | |
| if p, ok := playerHandleMap[handle]; ok { | |
| return p | |
| } | |
| return Player{} | |
| } | |
| // FindPlayerByCountry returns all players within the given country, | |
| // if exists. Otherwise, an empty slice is returned. | |
| func FindPlayerByCountry(code string) []Player { | |
| if ps, ok := playerCountryMap[code]; ok { | |
| return ps | |
| } | |
| return []Player{} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment