collections

package
v0.0.0-...-fe78ce7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountIDs

type AccountIDs []nspb.AccountID

func (AccountIDs) AddUnique

func (s AccountIDs) AddUnique(ids ...nspb.AccountID) AccountIDs

type FollowedPlayers

type FollowedPlayers []*models.FollowedPlayer

func (FollowedPlayers) AccountIDs

func (s FollowedPlayers) AccountIDs() AccountIDs

func (FollowedPlayers) KeyByAccountID

func (s FollowedPlayers) KeyByAccountID() map[nspb.AccountID]*models.FollowedPlayer

type HeroIDs

type HeroIDs []nspb.HeroID

type Heroes

type Heroes []*models.Hero

type LeagueIDs

type LeagueIDs []nspb.LeagueID

type Leagues

type Leagues []*models.League

type LiveMatchPlayers

type LiveMatchPlayers []*models.LiveMatchPlayer

func (LiveMatchPlayers) AccountIDs

func (s LiveMatchPlayers) AccountIDs() AccountIDs

func (LiveMatchPlayers) GroupByAccountID

func (s LiveMatchPlayers) GroupByAccountID() map[nspb.AccountID]LiveMatchPlayers

func (LiveMatchPlayers) GroupByMatchID

func (s LiveMatchPlayers) GroupByMatchID() map[nspb.MatchID]LiveMatchPlayers

func (LiveMatchPlayers) MatchIDs

func (s LiveMatchPlayers) MatchIDs() MatchIDs

type LiveMatchStats

type LiveMatchStats []*models.LiveMatchStats

func (LiveMatchStats) GroupByMatchID

func (s LiveMatchStats) GroupByMatchID() map[nspb.MatchID]LiveMatchStats

func (LiveMatchStats) KeyByMatchID

func (s LiveMatchStats) KeyByMatchID() map[nspb.MatchID]*models.LiveMatchStats

func (LiveMatchStats) MatchIDs

func (s LiveMatchStats) MatchIDs() MatchIDs

type LiveMatchStatsPlayers

type LiveMatchStatsPlayers []*models.LiveMatchStatsPlayer

func (LiveMatchStatsPlayers) AccountIDs

func (s LiveMatchStatsPlayers) AccountIDs() AccountIDs

func (LiveMatchStatsPlayers) GroupByAccountID

func (s LiveMatchStatsPlayers) GroupByAccountID() map[nspb.AccountID]LiveMatchStatsPlayers

func (LiveMatchStatsPlayers) GroupByMatchID

func (LiveMatchStatsPlayers) MatchIDs

func (s LiveMatchStatsPlayers) MatchIDs() MatchIDs

type LiveMatches

type LiveMatches []*models.LiveMatch

func (LiveMatches) Batches

func (s LiveMatches) Batches(batchSize int) []LiveMatches

func (*LiveMatches) Insert

func (s *LiveMatches) Insert(i int, liveMatch *models.LiveMatch)

func (LiveMatches) KeyByMatchID

func (s LiveMatches) KeyByMatchID() map[nspb.MatchID]*models.LiveMatch

func (LiveMatches) Len

func (s LiveMatches) Len() int

func (LiveMatches) MatchIDs

func (s LiveMatches) MatchIDs() MatchIDs

func (*LiveMatches) Pop

func (s *LiveMatches) Pop() (liveMatch *models.LiveMatch)

func (*LiveMatches) Push

func (s *LiveMatches) Push(liveMatch *models.LiveMatch)

func (*LiveMatches) Remove

func (s *LiveMatches) Remove(i int) *models.LiveMatch

func (*LiveMatches) RemoveDeactivated

func (s *LiveMatches) RemoveDeactivated() LiveMatches

func (*LiveMatches) Shift

func (s *LiveMatches) Shift() (liveMatch *models.LiveMatch)

func (LiveMatches) Swap

func (s LiveMatches) Swap(i, j int)

func (*LiveMatches) Unshift

func (s *LiveMatches) Unshift(liveMatch *models.LiveMatch)

type LiveMatchesByScore

type LiveMatchesByScore struct {
	LiveMatches
	// contains filtered or unexported fields
}

func NewLiveMatchesByScore

func NewLiveMatchesByScore(matches ...*models.LiveMatch) *LiveMatchesByScore

func (*LiveMatchesByScore) Add

func (s *LiveMatchesByScore) Add(match *models.LiveMatch) int

Add inserts a match in sorted order if it isn't present (matched by MatchID). If it's present, it updates the match (including SortScore, which will reposition the match) if the match changed.

It returns the match index if the match was added or updated, otherwise returns -1.

func (*LiveMatchesByScore) All

func (*LiveMatchesByScore) At

func (*LiveMatchesByScore) FindIndex

func (s *LiveMatchesByScore) FindIndex(matchID nspb.MatchID) int

FindIndex [O(n)] finds the index of a LiveMatch with the given matchID.

It returns -1 if the matchID was not found.

func (*LiveMatchesByScore) Less

func (s *LiveMatchesByScore) Less(i, j int) bool

func (*LiveMatchesByScore) Remove

func (s *LiveMatchesByScore) Remove(matchID nspb.MatchID) nspb.MatchID

func (*LiveMatchesByScore) SearchIndex

func (s *LiveMatchesByScore) SearchIndex(match *models.LiveMatch) int

SearchIndex [O(log n)] performs a binary search for an index where the given match is or would be in sorted order by SortScore.

It returns Len() if the match was not found.

type LiveMatchesContainer

type LiveMatchesContainer struct {
	// contains filtered or unexported fields
}

func NewLiveMatchesContainer

func NewLiveMatchesContainer(matches ...*models.LiveMatch) *LiveMatchesContainer

func (*LiveMatchesContainer) Add

func (m *LiveMatchesContainer) Add(matches ...*models.LiveMatch) LiveMatches

func (*LiveMatchesContainer) All

func (*LiveMatchesContainer) Len

func (m *LiveMatchesContainer) Len() int

func (*LiveMatchesContainer) Remove

func (m *LiveMatchesContainer) Remove(matchIDs ...nspb.MatchID) MatchIDs

type MatchIDs

type MatchIDs []nspb.MatchID

func NewMatchIDs

func NewMatchIDs(s ...uint64) MatchIDs

func NewMatchIDsFromString

func NewMatchIDsFromString(s, sep string) (MatchIDs, error)

func (MatchIDs) AddUnique

func (s MatchIDs) AddUnique(ids ...nspb.MatchID) MatchIDs

func (MatchIDs) Join

func (s MatchIDs) Join(sep string) string

func (MatchIDs) ToUint64Interfaces

func (s MatchIDs) ToUint64Interfaces() []interface{}

func (MatchIDs) ToUint64s

func (s MatchIDs) ToUint64s() []uint64

type MatchPlayers

type MatchPlayers []*models.MatchPlayer

func (MatchPlayers) AccountIDs

func (s MatchPlayers) AccountIDs() AccountIDs

func (MatchPlayers) GroupByAccountID

func (s MatchPlayers) GroupByAccountID() map[nspb.AccountID]MatchPlayers

func (MatchPlayers) GroupByMatchID

func (s MatchPlayers) GroupByMatchID() map[nspb.MatchID]MatchPlayers

func (MatchPlayers) MatchIDs

func (s MatchPlayers) MatchIDs() MatchIDs

type Matches

type Matches []*models.Match

func (Matches) KeyByMatchID

func (s Matches) KeyByMatchID() map[nspb.MatchID]*models.Match

func (Matches) MatchIDs

func (s Matches) MatchIDs() MatchIDs

type Players

type Players []*models.Player

func (Players) AccountIDs

func (s Players) AccountIDs() AccountIDs

func (Players) GroupByAccountID

func (s Players) GroupByAccountID() map[nspb.AccountID]Players

func (Players) KeyByAccountID

func (s Players) KeyByAccountID() map[nspb.AccountID]*models.Player

type ProPlayers

type ProPlayers []*models.ProPlayer

func (ProPlayers) AccountIDs

func (s ProPlayers) AccountIDs() AccountIDs

func (ProPlayers) GroupByAccountID

func (s ProPlayers) GroupByAccountID() map[nspb.AccountID]ProPlayers

func (ProPlayers) KeyByAccountID

func (s ProPlayers) KeyByAccountID() map[nspb.AccountID]*models.ProPlayer

type TVGames

type TVGames []*d2pb.CSourceTVGameSmall

func (TVGames) Clean

func (s TVGames) Clean() TVGames

Clean cleans up Source TV games.

* Removes nil games * Removes games with invalid MatchId (zero) * De-duplicates games with same MatchId

De-duplication: elects the game with highest LastUpdateTime as the valid entry. Elected entries are placed in the same position as the first occurrence of duplicated entries.

It returns the slice sorted by descending SortScore.

func (TVGames) FindIndexByMatchID

func (s TVGames) FindIndexByMatchID(matchID nspb.MatchID) int

func (TVGames) GroupByMatchID

func (s TVGames) GroupByMatchID() map[nspb.MatchID]TVGames

func (TVGames) MatchIDs

func (s TVGames) MatchIDs() MatchIDs

func (TVGames) Pop

func (s TVGames) Pop() (TVGames, *d2pb.CSourceTVGameSmall)

func (TVGames) Remove

func (s TVGames) Remove(i int) (TVGames, *d2pb.CSourceTVGameSmall)

func (TVGames) RemoveByMatchID

func (s TVGames) RemoveByMatchID(matchID nspb.MatchID) (TVGames, *d2pb.CSourceTVGameSmall)

func (TVGames) Shift

func (s TVGames) Shift() (TVGames, *d2pb.CSourceTVGameSmall)

Jump to

Keyboard shortcuts

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