Adding multiple cummands for listing filtered and unfiltered pokememes
This commit is contained in:
@@ -30,5 +30,7 @@ type DataCacheInterface interface {
|
||||
DeletePokememeByID(pokememeID int) error
|
||||
|
||||
GetLeagueBySymbol(symbol string) (*dbmapping.League, error)
|
||||
|
||||
GetWeaponTypeByID(weaponID int) (*dbmapping.Weapon, error)
|
||||
GetWeaponTypeByName(name string) (*dbmapping.Weapon, error)
|
||||
}
|
||||
|
@@ -92,8 +92,9 @@ func (dc *DataCache) GetOrCreatePlayerByTelegramID(telegramID int) (*dbmapping.P
|
||||
|
||||
// GetPlayerByID returns player from datacache by ID
|
||||
func (dc *DataCache) GetPlayerByID(playerID int) (*dbmapping.Player, error) {
|
||||
c.Log.Info("DataCache: Getting player with ID=", playerID)
|
||||
c.Log.Info("DataCache: Getting player with ID = ", playerID)
|
||||
if dc.players[playerID] != nil {
|
||||
c.Log.Debug("DataCache: found player with ID = " + strconv.Itoa(playerID))
|
||||
return dc.players[playerID], nil
|
||||
}
|
||||
|
||||
|
@@ -111,6 +111,7 @@ func (dc *DataCache) GetProfileByID(profileID int) (*dbmapping.Profile, error) {
|
||||
// GetProfileByPlayerID returns current profile for player
|
||||
func (dc *DataCache) GetProfileByPlayerID(playerID int) (*dbmapping.Profile, error) {
|
||||
if dc.currentProfiles[playerID] != nil {
|
||||
c.Log.Debug("DataCache: found current profile for player with ID = " + strconv.Itoa(playerID))
|
||||
return dc.currentProfiles[playerID], nil
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,18 @@ func (dc *DataCache) loadWeapons() {
|
||||
|
||||
// External functions
|
||||
|
||||
// GetWeaponTypeByID returns weapon type from datacache by given ID
|
||||
func (dc *DataCache) GetWeaponTypeByID(weaponID int) (*dbmapping.Weapon, error) {
|
||||
dc.weaponsMutex.Lock()
|
||||
if dc.weapons[weaponID] != nil {
|
||||
c.Log.Debug("DataCache: found weapon type with ID = " + strconv.Itoa(weaponID))
|
||||
dc.weaponsMutex.Unlock()
|
||||
return dc.weapons[weaponID], nil
|
||||
}
|
||||
dc.weaponsMutex.Unlock()
|
||||
return nil, errors.New("There is no weapon type with ID = " + strconv.Itoa(weaponID))
|
||||
}
|
||||
|
||||
// GetWeaponTypeByName returns weapon type from datacache by weapon name
|
||||
func (dc *DataCache) GetWeaponTypeByName(name string) (*dbmapping.Weapon, error) {
|
||||
dc.weaponsMutex.Lock()
|
||||
|
Reference in New Issue
Block a user