models

package
v0.0.0-...-745d1a8 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(dsn string) (*gorm.DB, error)

Create creates the gorm database and creates the tables in the database if necessary.

func GenerateMatchID

func GenerateMatchID(id int, refTime time.Time) int64

GenerateMatchID creates the ID of the match. The reason for this is that the IDs given by pep.py, and thus the Ripple API, can repeat themselves. This is due to the fact that on a restart of pep.py, the IDs start from one again, and so to overcome this two games are considered of the same match only if they share the same match ID and have been created at most 29 minutes and 59 seconds apart (in a "worst case scenario")

Types

type DBVersion

type DBVersion struct {
	Version int
}

DBVersion is a table holding a single value: the version of the database.

type Game

type Game struct {
	ID        int   `gorm:"primary_key"`
	Match     Match `json:"-"`
	MatchID   int64 `json:",string"`
	Name      string
	BeatmapID int
	Mods      int64
	GameMode  int
	Scores    string `gorm:"type:text"`
	CreatedAt time.Time
}

Game represents a game (a single playthrough of a beatmap) of a match

type Match

type Match struct {
	ID        int64 `gorm:"primary_key" json:",string"`
	Name      string
	CreatedAt time.Time
}

Match represents a multiplayer match on Ripple.

type MatchRedirect

type MatchRedirect struct {
	ID        int64 `gorm:"primary_key"`
	CanonicID int64
}

MatchRedirect contains what matches some match IDs are referring to. ... It's complicated.

Jump to

Keyboard shortcuts

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