models

package
v0.0.0-...-24140c1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFoundError = errors.New("404")
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func DownloadReplay

func DownloadReplay(replay string, localFilePath string) error

func InitCloudLogger

func InitCloudLogger() zerolog.Logger

func InitStdLogger

func InitStdLogger() zerolog.Logger

func InitTrace

func InitTrace(runtimeProvider string) (trace.Tracer, error)

func Reverse

func Reverse(s string) string

func UnmarshalSpanCtx

func UnmarshalSpanCtx(code Code) trace.SpanContext

func ValidateCodes

func ValidateCodes(ctx context.Context, raw string) []string

Types

type ActivityCalendarDay

type ActivityCalendarDay struct {
	Time   int64   `json:"time"`
	Rating float64 `json:"rating"`
}

type BestUnit

type BestUnit struct {
	Name    string  `json:"name"`
	Winrate float32 `json:"winrate"`
}

type CheckReplay

type CheckReplay struct {
	NotFound []string `json:"not_found"`
	Ranked   []string `json:"ranked"`
	Unranked []string `json:"unranked"`
	Bot      []string `json:"bot"`
	Errored  []string `json:"errored"`
}

type Code

type Code struct {
	SpanCtx
	Code string `json:"code"`
}

func UnmarshalCode

func UnmarshalCode(e Event) (Code, error)

type Codes

type Codes struct {
	Codes []string `json:"codes"`
}

func UnmarshalCodes

func UnmarshalCodes(e Event) (Codes, error)

type DeckInfoV1

type DeckInfoV1 struct {
	MergedDeck []MergedDeck `json:"mergedDeck"`
}

type DeckInfoV2

type DeckInfoV2 struct {
	Randomizer [][]string `json:"randomizer"`
}

type Event

type Event struct {
	Data []byte
}

type GCPWriter

type GCPWriter struct {
	Logger logging.Logger
}

func (GCPWriter) Write

func (e GCPWriter) Write(p []byte) (int, error)

type GameRecord

type GameRecord struct {
	P1Win  int `bigquery:"p1w" json:"p1w"`
	P2Win  int `bigquery:"p2w" json:"p2w"`
	P1Draw int `bigquery:"p1d" json:"p1d"`
	P2Draw int `bigquery:"p2d" json:"p2d"`
	P1Loss int `bigquery:"p1l" json:"p1l"`
	P2Loss int `bigquery:"p2l" json:"p2l"`
}

func (GameRecord) Draws

func (g GameRecord) Draws() int

func (GameRecord) Losses

func (g GameRecord) Losses() int

func (GameRecord) TotalGames

func (g GameRecord) TotalGames() int

func (GameRecord) WinRate

func (g GameRecord) WinRate() float32

func (GameRecord) Wins

func (g GameRecord) Wins() int

type HighestOpponent

type HighestOpponent struct {
	Name   string  `json:"name" bigquery:"NAME"`
	Rating float32 `json:"rating" bigquery:"RATING"`
}

type KeyedGameRecord

type KeyedGameRecord struct {
	Name string `bigquery:"name" json:"name"`
	GameRecord
}

type MergedDeck

type MergedDeck struct {
	BaseSet *int   `json:"baseSet"`
	Name    string `json:"name"`
}

type PlayerActivityCalendar

type PlayerActivityCalendar struct {
	Calendar []ActivityCalendarDay `json:"calendar"`
}

type PlayerInfo

type PlayerInfo struct {
	Name              string  `json:"name" bigquery:"pname"`
	LastGameTimeStamp int     `json:"lastGameTimeStamp" bigquery:"LAST_GAME_TIME"`
	Rating            float32 `json:"rating" bigquery:"rating"`
	MaxRating         float32 `json:"maxRating" bigquery:"MAX_RATING"`
	GameRecord
}

type PlayerInfoV1

type PlayerInfoV1 struct {
	PlayerNames [2]string `json:"playerNames"`
	PlayerBots  [2]string `json:"playerBots"`
}

type PlayerInfoV2

type PlayerInfoV2 struct {
	DisplayName string  `json:"displayName"`
	Bot         *string `json:"bot"`
}

type PlayerRatingTimeSeries

type PlayerRatingTimeSeries struct {
	TierRatingData RatingSeries `json:"tierRatingData"`
	EloRatingData  RatingSeries `json:"eloRatingData"`
}

type PlayerRecord

type PlayerRecord struct {
	MaxRating       int             `json:"maxRating"`
	BestUnit        BestUnit        `json:"bestUnit"`
	HighestOpponent HighestOpponent `json:"highestOpponent"`
	WinStreak       WinStreak       `json:"winStreak"`
	GameRecord      GameRecord      `json:"gameRecord"`
}

type PlayerTime

type PlayerTime struct {
	Initial float32 `json:"initial"`
}

type PlayerUnitGameRecord

type PlayerUnitGameRecord struct {
	PlayerName string `bigquery:"pname"`
	Unit       string `bigquery:"UNIT"`
	GameRecord
}

type RangeConstrain

type RangeConstrain struct {
	From  int
	Until int
}

RangeConstrain Unix time in seconds

func UnboundTimeConstrain

func UnboundTimeConstrain() RangeConstrain

type Rating

type Rating struct {
	DisplayRating float32 `json:"displayRating"`
	Tier          int     `json:"tier"`
	TierPercent   float32 `json:"tierPercent"`
}

type RatingDistribution

type RatingDistribution struct {
	Rating []int `json:"rating"`
	Count  []int `json:"count"`
}

type RatingDistributionWrapper

type RatingDistributionWrapper struct {
	Tier RatingDistribution `json:"tier"`
	Elo  RatingDistribution `json:"elo"`
}

type RatingInfo

type RatingInfo struct {
	InitialRatings []Rating    `json:"initialRatings"`
	FinalRatings   []RatingOpt `json:"finalRatings"`
}

type RatingOpt

type RatingOpt struct {
	DisplayRating *float32 `json:"displayRating"`
	Tier          *int     `json:"tier"`
	TierPercent   *float32 `json:"tierPercent"`
}

type RatingSeries

type RatingSeries struct {
	Time   []int     `json:"time"`
	Rating []float32 `json:"rating"`
}

type RawReplayBase

type RawReplayBase struct {
	Code         string      `json:"code"`
	Format       int64       `json:"format"`
	StartTime    float64     `json:"startTime"`
	EndTime      float64     `json:"endTime"`
	VersionInfo  VersionInfo `json:"versionInfo"`
	Result       int64       `json:"result"`
	EndCondition int64       `json:"endCondition"`
	RatingInfo   RatingInfo  `json:"ratingInfo"`
}

func (RawReplayBase) GetCode

func (r RawReplayBase) GetCode() string

func (RawReplayBase) GetEndCondition

func (r RawReplayBase) GetEndCondition() int64

func (RawReplayBase) GetEndTime

func (r RawReplayBase) GetEndTime() int64

func (RawReplayBase) GetFormat

func (r RawReplayBase) GetFormat() int64

func (RawReplayBase) GetResult

func (r RawReplayBase) GetResult() int64

func (RawReplayBase) GetStartTime

func (r RawReplayBase) GetStartTime() int64

func (RawReplayBase) P1EloIni

func (r RawReplayBase) P1EloIni() float32

func (RawReplayBase) P1RatingChange

func (r RawReplayBase) P1RatingChange() float32

func (RawReplayBase) P2EloIni

func (r RawReplayBase) P2EloIni() float32

func (RawReplayBase) P2RatingChange

func (r RawReplayBase) P2RatingChange() float32

func (RawReplayBase) Version

func (r RawReplayBase) Version() int64

type RawReplayV1

type RawReplayV1 struct {
	RawReplayBase
	TimeInfo   TimeInfoV1   `json:"timeInfo"`
	DeckInfo   DeckInfoV1   `json:"deckInfo"`
	PlayerInfo PlayerInfoV1 `json:"playerInfo"`
}

func (RawReplayV1) Deck

func (r RawReplayV1) Deck() []string

func (RawReplayV1) P1Name

func (r RawReplayV1) P1Name() string

func (RawReplayV1) P2Name

func (r RawReplayV1) P2Name() string

func (RawReplayV1) TimeControl

func (r RawReplayV1) TimeControl() int64

type RawReplayV2

type RawReplayV2 struct {
	RawReplayBase
	TimeInfo   TimeInfoV2     `json:"timeInfo"`
	DeckInfo   DeckInfoV2     `json:"deckInfo"`
	PlayerInfo []PlayerInfoV2 `json:"playerInfo"`
}

func (RawReplayV2) Deck

func (r RawReplayV2) Deck() []string

func (RawReplayV2) P1Name

func (r RawReplayV2) P1Name() string

func (RawReplayV2) P2Name

func (r RawReplayV2) P2Name() string

func (RawReplayV2) TimeControl

func (r RawReplayV2) TimeControl() int64

type Replay

type Replay struct {
	Code           string   `bigquery:"CODE"`
	Format         int64    `bigquery:"FORMAT"`
	Deck           []string `bigquery:"DECK"`
	EndCondition   int64    `bigquery:"END_CONDITION"`
	Result         int64    `bigquery:"RESULT"` // 0: player1Win, 1:player2Win, 2:Draw
	TimeCondition  int64    `bigquery:"TIME_CONDITION"`
	StartTime      int64    `bigquery:"START_TIME"`
	EndTime        int64    `bigquery:"END_TIME"`
	Version        int64    `bigquery:"VERSION"`
	P1Name         string   `bigquery:"P1_NAME"`
	P1RatingIni    float64  `bigquery:"P1_RATING_INI"`
	P1RatingChange float64  `bigquery:"P1_RATING_CHANGE"`
	P2Name         string   `bigquery:"P2_NAME"`
	P2RatingIni    float64  `bigquery:"P2_RATING_INI"`
	P2RatingChange float64  `bigquery:"P2_RATING_CHANGE"`
}

func FromReplayLike

func FromReplayLike(r ReplayLike) Replay

type ReplayLike

type ReplayLike interface {
	GetCode() string
	GetFormat() int64
	GetStartTime() int64
	GetEndTime() int64
	Version() int64
	Deck() []string
	TimeControl() int64
	GetResult() int64 // 0 p1w, 1 p2w, 2 draw
	GetEndCondition() int64
	P1Name() string
	P1EloIni() float32
	P1RatingChange() float32
	P2Name() string
	P2EloIni() float32
	P2RatingChange() float32
}

func UnmarshalReplay

func UnmarshalReplay(data []byte) (ReplayLike, error)

type ReplayQuery

type ReplayQuery struct {
	Players         map[string]bool
	Units           []string
	TimeConstrain   RangeConstrain
	RatingConstrain RangeConstrain
	ReplayStrict    bool
	ReplayType      string
	Limit           int
}

type SpanCtx

type SpanCtx struct {
	TraceID string `json:"traceID"`
	SpanID  string `json:"spanID"`
}

func MarshalSpanCtx

func MarshalSpanCtx(span trace.Span) SpanCtx

type Telemetry

type Telemetry struct {
	Logger zerolog.Logger
	Tracer trace.Tracer
}

type TimeInfoV1

type TimeInfoV1 struct {
	PlayerInitialTimeBanks []int64 `json:"playerInitialTimeBanks"`
}

type TimeInfoV2

type TimeInfoV2 struct {
	PlayerTime []PlayerTime `json:"playerTime"`
}

type TimeOfDayActivity

type TimeOfDayActivity struct {
	Times []int `json:"times"` // 0-23
	Freq  []int `json:"freq"`  //GamesPlayed
}

type VersionInfo

type VersionInfo struct {
	ServerVersion int64 `json:"serverVersion"`
}

type WinRate

type WinRate struct {
	P1WinRate float32 `json:"p1wr"`
	P2WinRate float32 `json:"p2wr"`
	DrawRate  float32 `json:"drawR"`
}

type WinStreak

type WinStreak struct {
	Number int      `json:"number" bigquery:"streak_length"`
	Streak []string `json:"streak" bigquery:"streak"`
}

Jump to

Keyboard shortcuts

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