database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMiniPaginate = 5
View Source
const DefaultPaginate = 10
View Source
const DefaultTimeout = 3 * time.Second

Variables

View Source
var Conn *sql.DB
View Source
var ErrBGNotFound = errors.New("background file not found")
View Source
var ErrInvalidPath = errors.New("invalid game path")
View Source
var ErrNoScores = errors.New("no scores")

Functions

func CountPlaycountDates

func CountPlaycountDates(uid, mode int, dates map[string]int) error

func GetImage

func GetImage(id int) (string, error)

func GetTotalRecent

func GetTotalRecent(uid, mode int, hideFailed bool) (int, error)

Scores

func GetUserJudgements

func GetUserJudgements() ([]string, error)

func GraphCreateRange

func GraphCreateRange(earliest time.Time, dates map[string]int)

func GraphDateEarliest

func GraphDateEarliest(uid, mode int) (time.Time, error)

Stats

func LoadDB

func LoadDB() error

func TestConnection

func TestConnection() error

Types

type CountedScoreBoard

type CountedScoreBoard struct {
	Total  int
	Scores []ScoreBoard
}

type GradesCountStat

type GradesCountStat struct {
	AllGrades    map[string]int
	RankedGrades map[string]int
}

func GetGradeCount

func GetGradeCount(uid, mode int, pbOnly bool) (GradesCountStat, error)

type JudgeCountStat

type JudgeCountStat struct {
	CountMarv  int
	CountPerf  int
	CountGreat int
	CountGood  int
	CountOkay  int
	CountMiss  int
}

func GetJudgesCountStats

func GetJudgesCountStats(uid, mode int) (JudgeCountStat, error)

type LocalUsers

type LocalUsers struct {
	Id       string
	Username string
}

type LongestMap

type LongestMap struct {
	ScoreID int
	MapID   int

	Map struct {
		Title          string
		DifficultyName string
	}

	Total int
}

type LongestStat

type LongestStat struct {
	Hits  LongestMap
	Combo LongestMap
}

func GetLongestStats

func GetLongestStats(uid, mode int) (LongestStat, error)

type MostPlayed

type MostPlayed struct {
	MapID          int
	Title          string
	DifficultyName string
	Creator        string
	PlayCount      int
}

func GetMostPlayed

func GetMostPlayed(uid, mode, page int) ([]MostPlayed, error)

type OverallStats

type OverallStats struct {
	Accuracy       float64
	RankedAccuracy float64
	Performance    float64
}

func GetOverallStats

func GetOverallStats(uid, mode int) (OverallStats, error)

type PlayStats

type PlayStats struct {
	Playcount int
	Passed    int
	Failed    int
}

func GetPlayStats

func GetPlayStats(uid, mode int) (PlayStats, error)

type ScoreBoard

type ScoreBoard struct {
	ScoreID int
	MapID   int

	Score struct {
		DateTime              string
		Grade                 string
		Accuracy              float64
		RankedAccuracy        float64
		Mods                  string
		PerformanceRating     float64
		JudgementWindowPreset string
		PersonalBest          bool
	}

	Map struct {
		Artist         string
		Title          string
		DifficultyName string
		Creator        string
		RankedStatus   string
		LNPercent      float64
		Rating         float64
	}
}

func GetBestScores

func GetBestScores(
	uid, mode, page int,

	judgementWindowPreset string,
	RankedStatus string,
	LNPercent float64,
) ([]ScoreBoard, error)

func GetRecentScores

func GetRecentScores(
	uid, mode, page int,

	hideFailed bool,
) ([]ScoreBoard, error)

type ScoreDetails

type ScoreDetails struct {
	ScoreID int
	MapID   int

	Score struct {
		LocalProfileId        int
		Name                  string
		DateTime              string
		TotalScore            int
		MaxCombo              int
		Mods                  string
		ScrollSpeed           int
		PauseCount            int
		PerformanceRating     float64
		JudgementWindowPreset string
		PersonalBest          bool

		JudgedHits struct {
			Accuracy       float64
			Grade          string
			RankedAccuracy float64
			RankedGrade    string
			CountMarv      int
			CountPerf      int
			CountGreat     int
			CountGood      int
			CountOkay      int
			CountMiss      int
		}

		JudgementConfig struct {
			CountMarv  int
			CountPerf  int
			CountGreat int
			CountGood  int
			CountOkay  int
			CountMiss  int
		}

		RatingVersion string
	}

	Map struct {
		Artist         string
		Title          string
		DifficultyName string
		Creator        string
		RankedStatus   string

		DifficultyInfo struct {
			SongLength int
			BPM        float64
			LNPercent  float64
			Rating     float64
		}

		ModeInfo struct {
			Mode                       int
			DifficultyProcessorVersion string
			HasScratchKey              bool
		}
	}
}

func GetScoreDetails

func GetScoreDetails(id int) (ScoreDetails, error)

type TotalStats

type TotalStats struct {
	Hits  uint64
	Score uint64
}

func GetTotalStats

func GetTotalStats(uid, mode int) (TotalStats, error)

type Users

type Users struct {
	Local   []LocalUsers
	Unknown []LocalUsers
}

func GetUsers

func GetUsers() (Users, error)

Jump to

Keyboard shortcuts

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