model

package
v0.0.0-...-a75589f Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RankLinks = []*Link{}
View Source
var Stages = map[string]*Stage{}
View Source
var Worlds = []*World{}

Functions

func RecentRecords

func RecentRecords(db *sqlx.DB) (map[string][]*Run, error)

Types

type Link struct {
	Group, Name, Path string
	Prev, Next        *Link
	Stage             *Stage
	World             *World
}

type Run

type Run struct {
	AvgRank, Goal, Player                               string
	Clear, Points, PointsRank, PointsTime, Rank, Stages int
	Date                                                time.Time
	Stage                                               *Stage `db:"stage_id"`
	TimeRemaining, TimeTaken                            time.Duration
	VideoURL                                            *string
}

Contains the superset of fields every different table needs. TODO Probably needs splitting apart then there's a JSON API.

func OverallRuns

func OverallRuns(db *sqlx.DB) (runs []Run, err error)

func PlayerRuns

func PlayerRuns(db *sqlx.DB, player string) (runs []Run, err error)

type Stage

type Stage struct {
	ID    string        `json:"id"`
	Name  string        `json:"name"`
	Slug  string        `json:"slug"`
	Timer time.Duration `json:"timer"`
	World *World        `json:"-"`
}

func (*Stage) Path

func (s *Stage) Path() string

func (*Stage) Runs

func (s *Stage) Runs(db *sqlx.DB) ([]Run, error)

func (*Stage) Scan

func (s *Stage) Scan(id any) error

type Video

type Video struct {
	Goal, Player, VideoURL  string
	ID                      int
	Rank                    *int
	Stage                   *Stage `db:"stage_id"`
	TimeRemaining           time.Duration
	VideoAuthor, VideoTitle *string
}

func GetVideo

func GetVideo(db *sqlx.DB, id string) (*Video, error)

func Videos

func Videos(db *sqlx.DB) (videos []Video, err error)

type World

type World struct {
	Code   string   `json:"code"`
	Name   string   `json:"name"`
	Slug   string   `json:"slug"`
	Sort   int      `json:"-"`
	Stages []*Stage `json:"stages"`
}

func (*World) Path

func (w *World) Path() string

func (*World) Runs

func (w *World) Runs(db *sqlx.DB) (runs []Run, err error)

Jump to

Keyboard shortcuts

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