database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: AGPL-3.0, AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnderperformed = errors.New("score performed worst than previously submitted")

Functions

func Connect

func Connect() error

func Remove

func Remove(id uint64) error

func Synchronize

func Synchronize()

Types

type Board

type Board struct {
	TrackID          uint64    `db:"track_id" json:"track_id,omitempty"`
	ID               uint64    `db:"id" json:"id,omitempty"`
	DateCreated      time.Time `db:"date_created" json:"date_created,omitempty"`
	DateModified     time.Time `db:"date_modified" json:"date_modified,omitempty"`
	SHA3             string    `db:"sha3" json:"sha3,omitempty"`
	Jacket           []byte    `db:"jacket" json:"jacket,omitempty"`
	Charters         string    `db:"charters" json:"charters,omitempty"`
	DifficultyName   uint64    `db:"difficulty_name" json:"difficulty_name"`
	DifficultyRating uint8     `db:"difficulty_rating" json:"difficulty_rating"`
}

func BoardGetFromIDs

func BoardGetFromIDs(track, board uint64) (*Board, error)

type Profile

type Profile struct {
	ID                uint64   `db:"id" json:"id"`
	UUID              string   `db:"uuid" json:"uuid,omitempty"`
	Username          string   `json:"name,omitempty"`
	Groups            []string `json:"groups,omitempty"`
	Experience        uint64   `db:"experience" json:"experience"`
	Level             uint64   `db:"level" json:"level"`
	TotalScore        uint64   `db:"total_score" json:"total_score"`
	PlayCount         uint64   `db:"play_count" json:"play_count"`
	Mastery           uint8    `db:"mastery" json:"mastery"`
	PerformanceRating uint64   `db:"performance_rating" json:"performance_rating"`
}

HACK: I'd like to get rid of this somehow, and get back to the pureness of a microservice application structure

func SelectProfileByUUID

func SelectProfileByUUID(uuid string) (error, *Profile)

type Score

type Score struct {
	ID                uint64    `db:"id" json:"id,omitempty"`
	TrackID           uint64    `db:"track_id" json:"track,omitempty"`
	BoardID           uint64    `db:"board_id" json:"board,omitempty"`
	ProfileID         uint64    `db:"profile_id" json:"profile,omitempty"`
	DateCreated       time.Time `db:"date_created" json:"date_created,omitempty"`
	GradeLetter       string    `db:"grade_letter" json:"grade,omitempty"`
	PerformanceRating float32   `db:"performance_rating" json:"performance,omitempty"`
	ScoreAmount       uint32    `db:"score_amount" json:"score,omitempty"`
	MaxCombo          uint64    `db:"max_combo" json:"combo,omitempty"`
	ClearStatus       uint8     `db:"clear_status" json:"status,omitempty"`
	EffectiveRate     float32   `db:"effective_rate" json:"rate,omitempty"`
	Accuracy          float64   `db:"accuracy" json:"accuracy,omitempty"`
	Criticals         uint32    `db:"criticals" json:"criticals,omitempty"`
	Nears             uint32    `db:"nears" json:"nears,omitempty"`
	Errors            uint32    `db:"errors" json:"errors,omitempty"`
	Modifiers         uint32    `db:"modifiers" json:"mods,omitempty"`
	Experience        uint16    `json:"xp,omitempty"`
	ReplayData        string    `db:"replay_data" json:"replay,omitempty"`
}

func SelectID

func SelectID(id uint64) (*Score, error)

func SelectOrdinally

func SelectOrdinally(track, board uint64, limit int, offset int) ([]*Score, error)

func (*Score) New

func (s *Score) New() error

Jump to

Keyboard shortcuts

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