datacache

package
v0.0.0-...-3723a19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ac *appcontext.Context)

New is an initialization function for appcontext

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) AddPlayer

func (dc *DataCache) AddPlayer(player *dbmapping.Player) (int, error)

AddPlayer creates new player in database

func (*DataCache) AddPlayerToSquad

func (dc *DataCache) AddPlayerToSquad(relation *dbmapping.SquadPlayer) (int, error)

AddPlayerToSquad creates relation between player and squad

func (*DataCache) AddProfile

func (dc *DataCache) AddProfile(profile *dbmapping.Profile) (int, error)

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

func (dc *DataCache) ChangePlayerKarma(addition int, playerID int) (*dbmapping.Player, error)

ChangePlayerKarma changes karma value for user

func (*DataCache) FindElementIDBySymbol

func (dc *DataCache) FindElementIDBySymbol(symbol string) (int, error)

FindElementIDBySymbol returns element ID for given symbol

func (*DataCache) FindLocationIDByName

func (dc *DataCache) FindLocationIDByName(name string) (int, error)

FindLocationIDByName returns location ID for given location name

func (*DataCache) GetAllGroupChats

func (dc *DataCache) GetAllGroupChats() []dbmapping.Chat

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

func (dc *DataCache) GetAllPrivateChats() []dbmapping.Chat

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

func (dc *DataCache) GetAllSquadsChats() []dbmapping.Chat

GetAllSquadsChats returns all chats belonging to squads

func (*DataCache) GetAllSquadsWithChats

func (dc *DataCache) GetAllSquadsWithChats() []dbmapping.SquadChat

GetAllSquadsWithChats returns all squads with chats

func (*DataCache) GetAvailableSquadsChatsForUser

func (dc *DataCache) GetAvailableSquadsChatsForUser(userID int) []dbmapping.Chat

GetAvailableSquadsChatsForUser returns all squads chats accessible by user with given ID

func (*DataCache) GetChatByID

func (dc *DataCache) GetChatByID(chatID int) (*dbmapping.Chat, error)

GetChatByID returns Chat by it's ID

func (*DataCache) GetCommandersForSquad

func (dc *DataCache) GetCommandersForSquad(squadID int) []dbmapping.Player

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

func (dc *DataCache) GetGroupChatsByIDs(chatIDs []int) []dbmapping.Chat

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

func (dc *DataCache) GetLeaguePrivateChats() []dbmapping.Chat

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

func (dc *DataCache) GetOrCreateChat(update *tgbotapi.Update) (*dbmapping.Chat, error)

GetOrCreateChat returns current or new Chat object by Telegram update

func (*DataCache) GetOrCreatePlayerByTelegramID

func (dc *DataCache) GetOrCreatePlayerByTelegramID(telegramID int) (*dbmapping.Player, error)

GetOrCreatePlayerByTelegramID finds user by Telegram ID and creates one if not exist

func (*DataCache) GetPlayerByID

func (dc *DataCache) GetPlayerByID(playerID int) (*dbmapping.Player, error)

GetPlayerByID returns player from datacache by ID

func (*DataCache) GetPlayerByTelegramID

func (dc *DataCache) GetPlayerByTelegramID(telegramID int) (*dbmapping.Player, error)

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

func (dc *DataCache) GetPokememesCountByGradeAndLocation(grade int, locationID int) int

GetPokememesCountByGradeAndLocation returns pokememes count with given grade on given location

func (*DataCache) GetProfileByID

func (dc *DataCache) GetProfileByID(profileID int) (*dbmapping.Profile, error)

GetProfileByID returns profile from datacache by ID

func (*DataCache) GetProfileByPlayerID

func (dc *DataCache) GetProfileByPlayerID(playerID int) (*dbmapping.Profile, error)

GetProfileByPlayerID returns current profile for player

func (*DataCache) GetSquadByChatID

func (dc *DataCache) GetSquadByChatID(chatID int) (*dbmapping.Squad, error)

GetSquadByChatID returns squad with given chat ID

func (*DataCache) GetSquadByID

func (dc *DataCache) GetSquadByID(squadID int) (*dbmapping.SquadChat, error)

GetSquadByID returns squad with given ID

func (*DataCache) GetSquadsChatsBySquadsIDs

func (dc *DataCache) GetSquadsChatsBySquadsIDs(squadsIDs []int) []dbmapping.Chat

GetSquadsChatsBySquadsIDs returns chats for given squad IDs

func (*DataCache) GetUserRoleInSquad

func (dc *DataCache) GetUserRoleInSquad(squadID int, playerID int) string

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) Init

func (dc *DataCache) Init()

Init is a initialization function for package

func (*DataCache) UpdateChatTitle

func (dc *DataCache) UpdateChatTitle(chatID int, newTitle string) (*dbmapping.Chat, error)

UpdateChatTitle updates chat title with new one

func (*DataCache) UpdatePlayerFields

func (dc *DataCache) UpdatePlayerFields(player *dbmapping.Player) (*dbmapping.Player, error)

UpdatePlayerFields writes new fields to player

func (*DataCache) UpdatePlayerTimestamp

func (dc *DataCache) UpdatePlayerTimestamp(playerID int) error

UpdatePlayerTimestamp writes current update time to player

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL