Documentation ¶
Index ¶
- func New(ac *appcontext.Context)
- type DataCache
- func (dc *DataCache) AddPlayer(player *dbmapping.Player) (int, error)
- func (dc *DataCache) AddPlayerToSquad(relation *dbmapping.SquadPlayer) (int, error)
- func (dc *DataCache) AddProfile(profile *dbmapping.Profile) (int, error)
- func (dc *DataCache) AddTournamentReport(tournamentNumber int, playerID int, target string) (int, error)
- func (dc *DataCache) ChangePlayerKarma(addition int, playerID int) (*dbmapping.Player, error)
- func (dc *DataCache) FindElementIDBySymbol(symbol string) (int, error)
- func (dc *DataCache) FindLocationIDByName(name string) (int, error)
- func (dc *DataCache) GetAllGroupChats() []dbmapping.Chat
- func (dc *DataCache) GetAllPokememes() map[int]*datamapping.PokememeFull
- func (dc *DataCache) GetAllPrivateChats() []dbmapping.Chat
- func (dc *DataCache) GetAllSquadMembers(squadID int) []dbmapping.SquadPlayerFull
- func (dc *DataCache) GetAllSquadsChats() []dbmapping.Chat
- func (dc *DataCache) GetAllSquadsWithChats() []dbmapping.SquadChat
- func (dc *DataCache) GetAvailableSquadsChatsForUser(userID int) []dbmapping.Chat
- func (dc *DataCache) GetChatByID(chatID int) (*dbmapping.Chat, error)
- func (dc *DataCache) GetCommandersForSquad(squadID int) []dbmapping.Player
- func (dc *DataCache) GetElementByID(elementID int) (*datamapping.Element, error)
- func (dc *DataCache) GetGroupChatsByIDs(chatIDs []int) []dbmapping.Chat
- func (dc *DataCache) GetLeagueByEnglishName(name string) (*datamapping.League, error)
- func (dc *DataCache) GetLeagueByID(leagueID int) (*datamapping.League, error)
- func (dc *DataCache) GetLeagueByName(name string) (*datamapping.League, error)
- func (dc *DataCache) GetLeagueBySymbol(symbol string) (*datamapping.League, error)
- func (dc *DataCache) GetLeaguePrivateChats() []dbmapping.Chat
- func (dc *DataCache) GetLevelByID(levelID int) (*datamapping.Level, error)
- func (dc *DataCache) GetOrCreateChat(update *tgbotapi.Update) (*dbmapping.Chat, error)
- func (dc *DataCache) GetOrCreatePlayerByTelegramID(telegramID int) (*dbmapping.Player, error)
- func (dc *DataCache) GetPlayerByID(playerID int) (*dbmapping.Player, error)
- func (dc *DataCache) GetPlayerByTelegramID(telegramID int) (*dbmapping.Player, error)
- func (dc *DataCache) GetPlayersWithCurrentProfiles() map[int]*dbmapping.PlayerProfile
- func (dc *DataCache) GetPokememeByID(pokememeID int) (*datamapping.PokememeFull, error)
- func (dc *DataCache) GetPokememeByName(pokememeName string) (*datamapping.PokememeFull, error)
- func (dc *DataCache) GetPokememesCountByGradeAndLocation(grade int, locationID int) int
- func (dc *DataCache) GetProfileByID(profileID int) (*dbmapping.Profile, error)
- func (dc *DataCache) GetProfileByPlayerID(playerID int) (*dbmapping.Profile, error)
- func (dc *DataCache) GetSquadByChatID(chatID int) (*dbmapping.Squad, error)
- func (dc *DataCache) GetSquadByID(squadID int) (*dbmapping.SquadChat, error)
- func (dc *DataCache) GetSquadsChatsBySquadsIDs(squadsIDs []int) []dbmapping.Chat
- func (dc *DataCache) GetUserRoleInSquad(squadID int, playerID int) string
- func (dc *DataCache) GetUserRolesInSquads(userID int) []dbmapping.SquadPlayerFull
- func (dc *DataCache) GetWeaponTypeByAttack(attack int) (*datamapping.Weapon, error)
- func (dc *DataCache) GetWeaponTypeByID(weaponID int) (*datamapping.Weapon, error)
- func (dc *DataCache) GetWeaponTypeByName(name string) (*datamapping.Weapon, error)
- func (dc *DataCache) Init()
- func (dc *DataCache) UpdateChatTitle(chatID int, newTitle string) (*dbmapping.Chat, error)
- func (dc *DataCache) UpdatePlayerFields(player *dbmapping.Player) (*dbmapping.Player, error)
- func (dc *DataCache) UpdatePlayerTimestamp(playerID int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataCache ¶
type DataCache struct {
// contains filtered or unexported fields
}
DataCache is a function-handling struct for package datacache. Also, it's a data cache: it handles all data, powered by DataCache functions.
func (*DataCache) AddPlayerToSquad ¶
func (dc *DataCache) AddPlayerToSquad(relation *dbmapping.SquadPlayer) (int, error)
AddPlayerToSquad creates relation between player and squad
func (*DataCache) AddProfile ¶
AddProfile creates new profile in database
func (*DataCache) AddTournamentReport ¶
func (dc *DataCache) AddTournamentReport(tournamentNumber int, playerID int, target string) (int, error)
AddTournamentReport creates new tournament report in database
func (*DataCache) ChangePlayerKarma ¶
ChangePlayerKarma changes karma value for user
func (*DataCache) FindElementIDBySymbol ¶
FindElementIDBySymbol returns element ID for given symbol
func (*DataCache) FindLocationIDByName ¶
FindLocationIDByName returns location ID for given location name
func (*DataCache) GetAllGroupChats ¶
GetAllGroupChats returns all bot's group chats
func (*DataCache) GetAllPokememes ¶
func (dc *DataCache) GetAllPokememes() map[int]*datamapping.PokememeFull
GetAllPokememes returns all pokememes
func (*DataCache) GetAllPrivateChats ¶
GetAllPrivateChats returns all bot's private chats
func (*DataCache) GetAllSquadMembers ¶
func (dc *DataCache) GetAllSquadMembers(squadID int) []dbmapping.SquadPlayerFull
GetAllSquadMembers returns all squad members by squad ID
func (*DataCache) GetAllSquadsChats ¶
GetAllSquadsChats returns all chats belonging to squads
func (*DataCache) GetAllSquadsWithChats ¶
GetAllSquadsWithChats returns all squads with chats
func (*DataCache) GetAvailableSquadsChatsForUser ¶
GetAvailableSquadsChatsForUser returns all squads chats accessible by user with given ID
func (*DataCache) GetChatByID ¶
GetChatByID returns Chat by it's ID
func (*DataCache) GetCommandersForSquad ¶
GetCommandersForSquad returns all players which are commanders of squad with given ID
func (*DataCache) GetElementByID ¶
func (dc *DataCache) GetElementByID(elementID int) (*datamapping.Element, error)
GetElementByID returns element with given ID
func (*DataCache) GetGroupChatsByIDs ¶
GetGroupChatsByIDs returns bot's group chats with given IDs
func (*DataCache) GetLeagueByEnglishName ¶
func (dc *DataCache) GetLeagueByEnglishName(name string) (*datamapping.League, error)
GetLeagueByEnglishName returns league from datacache by english name
func (*DataCache) GetLeagueByID ¶
func (dc *DataCache) GetLeagueByID(leagueID int) (*datamapping.League, error)
GetLeagueByID returns league from datacache by ID
func (*DataCache) GetLeagueByName ¶
func (dc *DataCache) GetLeagueByName(name string) (*datamapping.League, error)
GetLeagueByName returns league from datacache by name
func (*DataCache) GetLeagueBySymbol ¶
func (dc *DataCache) GetLeagueBySymbol(symbol string) (*datamapping.League, error)
GetLeagueBySymbol returns league from datacache by emoji
func (*DataCache) GetLeaguePrivateChats ¶
GetLeaguePrivateChats returns private chats for all league members
func (*DataCache) GetLevelByID ¶
func (dc *DataCache) GetLevelByID(levelID int) (*datamapping.Level, error)
GetLevelByID returns level data by ID
func (*DataCache) GetOrCreateChat ¶
GetOrCreateChat returns current or new Chat object by Telegram update
func (*DataCache) GetOrCreatePlayerByTelegramID ¶
GetOrCreatePlayerByTelegramID finds user by Telegram ID and creates one if not exist
func (*DataCache) GetPlayerByID ¶
GetPlayerByID returns player from datacache by ID
func (*DataCache) GetPlayerByTelegramID ¶
GetPlayerByTelegramID returns player with such Telegram ID
func (*DataCache) GetPlayersWithCurrentProfiles ¶
func (dc *DataCache) GetPlayersWithCurrentProfiles() map[int]*dbmapping.PlayerProfile
GetPlayersWithCurrentProfiles returns users with profiles, if exist
func (*DataCache) GetPokememeByID ¶
func (dc *DataCache) GetPokememeByID(pokememeID int) (*datamapping.PokememeFull, error)
GetPokememeByID returns pokememe with additional information by ID
func (*DataCache) GetPokememeByName ¶
func (dc *DataCache) GetPokememeByName(pokememeName string) (*datamapping.PokememeFull, error)
GetPokememeByName returns pokememe with additional information by name
func (*DataCache) GetPokememesCountByGradeAndLocation ¶
GetPokememesCountByGradeAndLocation returns pokememes count with given grade on given location
func (*DataCache) GetProfileByID ¶
GetProfileByID returns profile from datacache by ID
func (*DataCache) GetProfileByPlayerID ¶
GetProfileByPlayerID returns current profile for player
func (*DataCache) GetSquadByChatID ¶
GetSquadByChatID returns squad with given chat ID
func (*DataCache) GetSquadByID ¶
GetSquadByID returns squad with given ID
func (*DataCache) GetSquadsChatsBySquadsIDs ¶
GetSquadsChatsBySquadsIDs returns chats for given squad IDs
func (*DataCache) GetUserRoleInSquad ¶
GetUserRoleInSquad returns user role in specified squad
func (*DataCache) GetUserRolesInSquads ¶
func (dc *DataCache) GetUserRolesInSquads(userID int) []dbmapping.SquadPlayerFull
GetUserRolesInSquads returns all user roles for given user ID
func (*DataCache) GetWeaponTypeByAttack ¶
func (dc *DataCache) GetWeaponTypeByAttack(attack int) (*datamapping.Weapon, error)
GetWeaponTypeByAttack returns weapon type from datacache by given attack
func (*DataCache) GetWeaponTypeByID ¶
func (dc *DataCache) GetWeaponTypeByID(weaponID int) (*datamapping.Weapon, error)
GetWeaponTypeByID returns weapon type from datacache by given ID
func (*DataCache) GetWeaponTypeByName ¶
func (dc *DataCache) GetWeaponTypeByName(name string) (*datamapping.Weapon, error)
GetWeaponTypeByName returns weapon type from datacache by weapon name
func (*DataCache) UpdateChatTitle ¶
UpdateChatTitle updates chat title with new one
func (*DataCache) UpdatePlayerFields ¶
UpdatePlayerFields writes new fields to player
func (*DataCache) UpdatePlayerTimestamp ¶
UpdatePlayerTimestamp writes current update time to player