views

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingMatchID         = errors.New("missing match ID")
	ErrInconsistentMatchIDs   = errors.New("inconsistent match IDs")
	ErrMissingAccountID       = errors.New("missing account ID")
	ErrInconsistentAccountIDs = errors.New("inconsistent account IDs")
	ErrMissingHeroID          = errors.New("missing hero ID")
)

Functions

func LiveMatchFromModel

func LiveMatchFromModel(m *models.LiveMatch) (*nspb.LiveMatch, error)

func NewHero

func NewHero(h *models.Hero) *nspb.Hero

func NewHeroMatches

func NewHeroMatches(
	hero *models.Hero,
	knownPlayers PlayersData,
	matchesData MatchesData,
) (*nspb.HeroMatches, error)

func NewHeroes

func NewHeroes(heroes []*models.Hero) *nspb.Heroes

func NewLeague

func NewLeague(league *models.League) (*nspb.League, error)

func NewLeagues

func NewLeagues(leagues []*models.League) (*nspb.Leagues, error)

func NewLiveMatch

func NewLiveMatch(
	liveMatch *models.LiveMatch,
	stats *models.LiveMatchStats,
	followed map[nspb.AccountID]*models.FollowedPlayer,
	players map[nspb.AccountID]*models.Player,
	proPlayers map[nspb.AccountID]*models.ProPlayer,
) (*nspb.LiveMatch, error)

func NewLiveMatchPlayer

func NewLiveMatchPlayer(
	followed *models.FollowedPlayer,
	player *models.Player,
	proPlayer *models.ProPlayer,
	livePlayer *models.LiveMatchPlayer,
	statsPlayer *models.LiveMatchStatsPlayer,
) *nspb.LiveMatch_Player

func NewLiveMatches

func NewLiveMatches(
	liveMatches []*models.LiveMatch,
	stats map[nspb.MatchID]*models.LiveMatchStats,
	followed map[nspb.AccountID]*models.FollowedPlayer,
	players map[nspb.AccountID]*models.Player,
	proPlayers map[nspb.AccountID]*models.ProPlayer,
) (*nspb.LiveMatches, error)

func NewMatch

func NewMatch(data *MatchData) (*nspb.Match, error)

func NewMatchPlayer

func NewMatchPlayer(data *MatchPlayerData) (*nspb.Match_Player, error)

func NewMatches

func NewMatches(data MatchesData) ([]*nspb.Match, error)

func NewPlayer

func NewPlayer(data *PlayerData) (*nspb.Player, error)

func NewPlayerMatches

func NewPlayerMatches(
	data *PlayerData,
	knownPlayers PlayersData,
	matchesData MatchesData,
) (*nspb.PlayerMatches, error)

func NewPlayers

func NewPlayers(data PlayersData) ([]*nspb.Player, error)

func NewSearch

func NewSearch(
	heroes []*models.Hero,
	followed []*models.FollowedPlayer,
	players []*models.Player,
	proPlayers []*models.ProPlayer,
) *nspb.Search

func NewSearchPlayer

func NewSearchPlayer(
	followed *models.FollowedPlayer,
	player *models.Player,
	proPlayer *models.ProPlayer,
) *nspb.Search_Player

func NewSortedMatches

func NewSortedMatches(data MatchesData) ([]*nspb.Match, error)

func NewSortedPlayers

func NewSortedPlayers(data PlayersData) ([]*nspb.Player, error)

func NewTeam

func NewTeam(team *models.Team) *nspb.Team

Types

type ErrAssociationNotEagerLoaded

type ErrAssociationNotEagerLoaded struct {
	Association string
}

func NewErrAssociationNotEagerLoaded

func NewErrAssociationNotEagerLoaded(association string) *ErrAssociationNotEagerLoaded

func (*ErrAssociationNotEagerLoaded) Error

func (err *ErrAssociationNotEagerLoaded) Error() string

type MatchData

type MatchData struct {
	MatchID        nspb.MatchID
	Match          *models.Match
	LiveMatch      *models.LiveMatch
	LiveMatchStats []*models.LiveMatchStats
	PlayersData    MatchPlayersData
}

func NewMatchData

func NewMatchData(
	match *models.Match,
	liveMatch *models.LiveMatch,
	stats []*models.LiveMatchStats,
	playersData MatchPlayersData,
) *MatchData

func (*MatchData) AccountIDs

func (d *MatchData) AccountIDs() nscol.AccountIDs

func (*MatchData) Validate

func (d *MatchData) Validate() error

type MatchPlayerData

type MatchPlayerData struct {
	MatchID               nspb.MatchID
	AccountID             nspb.AccountID
	MatchPlayer           *models.MatchPlayer
	LiveMatchPlayer       *models.LiveMatchPlayer
	LiveMatchStatsPlayers nscol.LiveMatchStatsPlayers
}

func NewMatchPlayerData

func NewMatchPlayerData(
	matchPlayer *models.MatchPlayer,
	livePlayer *models.LiveMatchPlayer,
	statsPlayers nscol.LiveMatchStatsPlayers,
) *MatchPlayerData

func (*MatchPlayerData) Validate

func (d *MatchPlayerData) Validate() error

type MatchPlayersData

type MatchPlayersData map[nspb.AccountID]*MatchPlayerData

func NewMatchPlayersData

func NewMatchPlayersData(data ...*MatchPlayerData) (MatchPlayersData, error)

func (MatchPlayersData) Validate

func (d MatchPlayersData) Validate() error

type MatchesData

type MatchesData map[nspb.MatchID]*MatchData

func NewMatchesData

func NewMatchesData(data ...*MatchData) (MatchesData, error)

func (MatchesData) AccountIDs

func (d MatchesData) AccountIDs() nscol.AccountIDs

func (MatchesData) MatchIDs

func (d MatchesData) MatchIDs() nscol.MatchIDs

type PlayerData

type PlayerData struct {
	AccountID      nspb.AccountID
	FollowedPlayer *models.FollowedPlayer
	Player         *models.Player
	ProPlayer      *models.ProPlayer
}

func NewPlayerData

func NewPlayerData(
	followedPlayer *models.FollowedPlayer,
	player *models.Player,
	proPlayer *models.ProPlayer,
) *PlayerData

func (*PlayerData) Validate

func (d *PlayerData) Validate() error

type PlayersData

type PlayersData map[nspb.AccountID]*PlayerData

func NewPlayersData

func NewPlayersData(playersData ...*PlayerData) (PlayersData, error)

Jump to

Keyboard shortcuts

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