store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package store defines the interface for seer data backends and provides implementations of them

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchData

type MatchData struct {
	Details *riot.MatchDetails `json:"details"`
}

MatchData is a container for details about a match

type Matches

type Matches []MatchData

Matches is a collection of MatchData. It can be sorted so that the most recent games come first.

func (Matches) Len

func (m Matches) Len() int

Less reports whether the element with index i should sort before the element with index j.

func (Matches) Less

func (m Matches) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (Matches) Swap

func (m Matches) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Store

type Store interface {
	Create(ctx context.Context, teamID string, team *Team) error

	Get(ctx context.Context, teamID string) (*Team, Matches, error)
	Add(ctx context.Context, teamID string, matches Matches) error
}

Store defines the contract different storage backends for Seer should have

func NewGitHubStore

func NewGitHubStore(ctx context.Context, l *zap.Logger, auth oauth2.TokenSource, repo config.GitHubStoreRepo) (Store, error)

NewGitHubStore instantiates a new Store backed by GitHub issues

type Team

type Team struct {
	Region  riot.Region      `json:"region"`
	Members []*riot.Summoner `json:"members"`
}

Team represents a team

func (*Team) GenerateTeamID

func (t *Team) GenerateTeamID() string

GenerateTeamID generates a new team ID for this team based on its region and member player IDs

Jump to

Keyboard shortcuts

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