backend

package
v0.0.0-...-eaf9504 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EURealm   = wargaming.RealmEu
	NARealm   = wargaming.RealmNa
	AsiaRealm = wargaming.RealmAsia
)
View Source
var (
	ErrShipReturnInvalid = errors.New("Invalid return size for ship listing")
	ErrWrongLengthPrefix = errors.New("The search should use a 3 letters prefix")
	ErrUnknownRealm      = errors.New("Unknown Wows realm/server")
)

Functions

func WowsRealm

func WowsRealm(realmStr string) (wargaming.Realm, error)

Types

type Backend

type Backend struct {
	ShipMapping    map[int]int
	Realm          wargaming.Realm
	Logger         *zap.SugaredLogger
	DB             *gorm.DB
	APICallCounter int
	PrefixBreak    int // Number of trigram prefixes scanned before breaking, usefull when testing
	ClanBreak      int // Number of clan to scan before braking, once again for testing
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(key string, realm string, logger *zap.SugaredLogger, db *gorm.DB) *Backend

func (*Backend) FillShipMapping

func (backend *Backend) FillShipMapping() error

func (*Backend) GetClansDetails

func (backend *Backend) GetClansDetails(clanIDs []int) (ret []*model.Clan, err error)

func (*Backend) GetPlayerDetails

func (backend *Backend) GetPlayerDetails(playerIds []int, withT10 bool) ([]*model.Player, error)

func (*Backend) GetPlayerT10Count

func (backend *Backend) GetPlayerT10Count(playerId int) (int, error)

func (*Backend) ListClansIds

func (backend *Backend) ListClansIds(page int) ([]int, error)

func (*Backend) LoadWowsVersionsFromCSV

func (backend *Backend) LoadWowsVersionsFromCSV(path string) error

func (*Backend) ScanAllPlayers

func (backend *Backend) ScanAllPlayers() (err error)

func (*Backend) ScanAllPlayersTrigram

func (backend *Backend) ScanAllPlayersTrigram(startingTrigramPrefix string, trigramPrefixCount *int) (err error)

func (*Backend) ScrapAll

func (backend *Backend) ScrapAll() (err error)

func (*Backend) ScrapAllClans

func (backend *Backend) ScrapAllClans() (err error)

func (*Backend) UpdateClans

func (backend *Backend) UpdateClans(clanIDs []int) error

func (*Backend) UpdateDetailsAllPlayers

func (backend *Backend) UpdateDetailsAllPlayers() (err error)

func (*Backend) UpdatePlayerBatch

func (backend *Backend) UpdatePlayerBatch(playerIDs []int, offset int)

func (*Backend) UpdatePlayerListT10

func (backend *Backend) UpdatePlayerListT10(playerList []*model.Player) ([]*model.Player, error)

func (*Backend) UpsertWowsVersion

func (backend *Backend) UpsertWowsVersion(version string, releaseDate time.Time) error

Jump to

Keyboard shortcuts

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