Documentation
¶
Index ¶
- Variables
- func CreateListRankOption(history []Match) [][2]ListRankOption
- func NewStore(pool *pgxpool.Pool) internal.Store
- func ParticipantDetailFromPG(participant Participant, summoner Summoner, ...) internal.ParticipantDetailOption
- func WithPostgresRankStatus2(rank *RankFull) internal.RankStatusOptiondeprecated
- func WithPostgresSummonerMatch(match Match, participant Participant, rankBefore, rankAfter *RankFull) internal.SummonerMatchOptiondeprecated
- type BatchTx
- type ListRankOption
- type Match
- type MatchStore
- func (db *MatchStore) CreateMatch(ctx context.Context, match Match) error
- func (db *MatchStore) CreateMatchInBatch(tx BatchTx, match Match)
- func (db *MatchStore) CreateParticipant(ctx context.Context, participant Participant) error
- func (db *MatchStore) CreateParticipantInBatch(tx BatchTx, participant Participant)
- func (db *MatchStore) GetMatch(ctx context.Context, id string) (Match, error)
- func (db *MatchStore) GetNewMatchIDs(ctx context.Context, ids []string) (newIDs []string, err error)
- func (db *MatchStore) GetParticipant(ctx context.Context, puuid riot.PUUID, matchID string) (Participant, error)
- func (db *MatchStore) GetParticipants(ctx context.Context, id string) ([]Participant, error)
- func (db *MatchStore) GetSummonerChampions(ctx context.Context, puuid riot.PUUID, start, end time.Time) ([]internal.SummonerChampion, error)
- func (db *MatchStore) ListMatchHistoryIDs(ctx context.Context, puuid riot.PUUID, start, end time.Time) ([]string, error)
- type Migrator
- type PGInstance
- type Participant
- type PostgresSearchResult2
- type PostgresToRankStatus
- type PostgresToSummonerMatchMapper
- type RankDetail
- type RankFull
- type RankStatus
- type RankStore
- func (db *RankStore) CreateRankDetail(ctx context.Context, detail RankDetail) error
- func (db *RankStore) CreateRankStatus(ctx context.Context, status RankStatus) (id int, err error)
- func (db *RankStore) GetRankDetail(ctx context.Context, id int) (RankDetail, error)
- func (db *RankStore) GetRankStatus(ctx context.Context, id int) (status RankStatus, err error)
- func (db *RankStore) ListRankIDs(ctx context.Context, puuid riot.PUUID, option ListRankOption) ([]int, error)
- type Store
- func (db *Store) GetChampions(ctx context.Context, puuid riot.PUUID, start, end time.Time) ([]internal.SummonerChampion, error)
- func (db *Store) GetMatchDetail(ctx context.Context, id string) (_ internal.MatchDetail, err error)
- func (db *Store) GetMatchHistory(ctx context.Context, puuid riot.PUUID, start, end time.Time) (matches []internal.SummonerMatch, err error)
- func (db *Store) GetNewMatchIDs(ctx context.Context, ids []string) (newIDs []string, err error)
- func (db *Store) GetProfileDetail(ctx context.Context, puuid riot.PUUID) (m internal.ProfileDetail, err error)
- func (db *Store) RecordMatch(ctx context.Context, match internal.Match) error
- func (db *Store) RecordProfile(ctx context.Context, summoner internal.Profile) error
- func (db *Store) SearchSummoner(ctx context.Context, q string) ([]internal.SearchResult, error)
- type Summoner
- type SummonerStore
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidRankStatuID = errors.New("invalid rank status id")
)
Functions ¶
func CreateListRankOption ¶
func CreateListRankOption(history []Match) [][2]ListRankOption
Should be unexported
func ParticipantDetailFromPG ¶
func ParticipantDetailFromPG(participant Participant, summoner Summoner, currentRank, rankBefore, rankAfter *RankFull) internal.ParticipantDetailOption
func WithPostgresRankStatus2
deprecated
func WithPostgresRankStatus2(rank *RankFull) internal.RankStatusOption
Deprecated: not using.
func WithPostgresSummonerMatch
deprecated
func WithPostgresSummonerMatch(match Match, participant Participant, rankBefore, rankAfter *RankFull) internal.SummonerMatchOption
Deprecated: not using.
Types ¶
type ListRankOption ¶
type MatchStore ¶
type MatchStore struct{ Tx Tx }
MatchStore manages match objects.
func (*MatchStore) CreateMatch ¶
func (db *MatchStore) CreateMatch(ctx context.Context, match Match) error
func (*MatchStore) CreateMatchInBatch ¶
func (db *MatchStore) CreateMatchInBatch(tx BatchTx, match Match)
func (*MatchStore) CreateParticipant ¶
func (db *MatchStore) CreateParticipant(ctx context.Context, participant Participant) error
func (*MatchStore) CreateParticipantInBatch ¶
func (db *MatchStore) CreateParticipantInBatch(tx BatchTx, participant Participant)
func (*MatchStore) GetNewMatchIDs ¶
func (*MatchStore) GetParticipant ¶
func (db *MatchStore) GetParticipant(ctx context.Context, puuid riot.PUUID, matchID string) (Participant, error)
func (*MatchStore) GetParticipants ¶
func (db *MatchStore) GetParticipants(ctx context.Context, id string) ([]Participant, error)
func (*MatchStore) GetSummonerChampions ¶
func (db *MatchStore) GetSummonerChampions(ctx context.Context, puuid riot.PUUID, start, end time.Time) ([]internal.SummonerChampion, error)
type PGInstance ¶
type PGInstance struct {
// contains filtered or unexported fields
}
func NewPGInstance ¶
func NewPGInstance(ctx context.Context, migrationsPath string) *PGInstance
NewPGInstance sets up a postgres server in a docker container. It will use the current schema version.
func (*PGInstance) SetupStore ¶
SetupStore creates an empty store, and will clean up after test t finishes.
type Participant ¶
type Participant struct {
PUUID string `db:"puuid"`
MatchID string `db:"match_id"`
TeamID int `db:"team"`
ChampionID int `db:"champion"`
ChampionLevel int `db:"champion_level"`
TeamPosition string `db:"position"`
SummonerIDs [2]int `db:"summoners"`
Runes [11]int `db:"runes"`
Items [7]int `db:"items"`
Kills int `db:"kills"`
Deaths int `db:"deaths"`
Assists int `db:"assists"`
KillParticipation float32 `db:"kill_participation"`
CreepScore int `db:"creep_score"`
CreepScorePerMinute float32 `db:"creep_score_per_minute"`
DamageDealt int `db:"damage_dealt"`
DamageTaken int `db:"damage_taken"`
DamageDeltaEnemy int `db:"damage_delta_enemy"`
DamagePercentageTeam float32 `db:"damage_percentage_team"`
GoldEarned int `db:"gold_earned"`
GoldDeltaEnemy int `db:"gold_delta_enemy"`
GoldPercentageTeam float32 `db:"gold_percentage_team"`
VisionScore int `db:"vision_score"`
PinkWardsBought int `db:"pink_wards_bought"`
}
type PostgresSearchResult2 ¶
type PostgresSearchResult2 struct {
Summoner Summoner
Status *RankStatus
Detail *RankDetail
}
func (*PostgresSearchResult2) Convert ¶
func (m *PostgresSearchResult2) Convert() internal.SearchResult
type PostgresToRankStatus ¶
type PostgresToRankStatus struct {
Status RankStatus
Detail *RankDetail
}
func (PostgresToRankStatus) Map ¶
func (mapper PostgresToRankStatus) Map() internal.RankStatus
type PostgresToSummonerMatchMapper ¶
type PostgresToSummonerMatchMapper struct {
Match Match
Participant Participant
BeforeStatus *RankStatus
BeforeDetail *RankDetail
AfterStatus *RankStatus
AfterDetail *RankDetail
}
func (PostgresToSummonerMatchMapper) Map ¶
func (mapper PostgresToSummonerMatchMapper) Map() internal.SummonerMatch
type RankDetail ¶
type RankFull ¶
type RankFull struct {
Status RankStatus
Detail *RankDetail
}
type RankStatus ¶
type RankStatus struct {
PUUID string `db:"puuid"`
EffectiveDate time.Time `db:"effective_date"`
// IsRanked indicates that there exists a [RankDetail] for this status.
IsRanked bool `db:"is_ranked"`
}
RankStatus is always created when a rank request is made.
type RankStore ¶
type RankStore struct{ Tx Tx }
func (*RankStore) CreateRankDetail ¶
func (db *RankStore) CreateRankDetail(ctx context.Context, detail RankDetail) error
func (*RankStore) CreateRankStatus ¶
CreateRankStatus creates a rank status and returns created id.
func (*RankStore) GetRankDetail ¶
func (*RankStore) GetRankStatus ¶
func (*RankStore) ListRankIDs ¶
type Store ¶
Store manages connections with a postgres database.
func (*Store) GetChampions ¶
func (*Store) GetMatchDetail ¶
func (*Store) GetMatchHistory ¶
func (*Store) GetNewMatchIDs ¶
func (*Store) GetProfileDetail ¶
func (*Store) RecordMatch ¶
func (*Store) RecordProfile ¶
func (*Store) SearchSummoner ¶
type SummonerStore ¶
type SummonerStore struct{ Tx Tx }
SummonerStore manages summoner objects.
func (*SummonerStore) CreateSummoner ¶
func (db *SummonerStore) CreateSummoner(ctx context.Context, summoner Summoner) error
func (*SummonerStore) GetSummoner ¶
func (*SummonerStore) SearchSummoner ¶
TODO: switch to fuzzy match algorithm.
Click to show internal directories.
Click to hide internal directories.