model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSettings

type AppSettings struct {
	GamePath                string
	SkillCacheSchemaVersion string
	LastSyncAt              string
}

AppSettings is a fixed, small set of runtime settings.

type Beatmap

type Beatmap struct {
	BeatmapID    int32 `db:"beatmap_id"`
	BeatmapSetID int32 `db:"beatmap_set_id"`

	Difficulty       string  `db:"difficulty"`
	MD5Hash          MD5Hash `db:"md5_hash"`
	FolderName       string  `db:"folder_name"`
	NameOfTheOsuFile string  `db:"name_of_the_osu_file"`
	AudioFileName    string  `db:"audio_file_name"`
	TitleFont        string  `db:"title_font"`

	ApproachRate      float32 `db:"approach_rate"`
	CircleSize        float32 `db:"circle_size"`
	HPDrain           float32 `db:"hp_drain"`
	OverallDifficulty float32 `db:"overall_difficulty"`
	SliderVelocity    float64 `db:"slider_velocity"`
	StackLeniency     float32 `db:"stack_leniency"`

	BPM        float64 `db:"bpm"`
	StarsNoMod float64 `db:"stars_nomod"`

	DrainTime            int32 `db:"drain_time"`
	TotalTime            int32 `db:"total_time"`
	PreviewAudioTime     int32 `db:"preview_audio_time"`
	ThreadID             int32 `db:"thread_id"`
	LastModificationTime int32 `db:"last_modification_time"`
	LastCheckedOsuRepo   int64 `db:"last_checked_osu_repo"`
	LastModification     int64 `db:"last_modification"`
	LastPlay             int64 `db:"last_play"`

	NumberOfHitcircles int16 `db:"number_of_hitcircles"`
	NumberOfSliders    int16 `db:"number_of_sliders"`
	NumberOfSpinners   int16 `db:"number_of_spinners"`
	LocalOffset        int16 `db:"local_offset"`
	OnlineOffset       int16 `db:"online_offset"`

	Mode               byte `db:"mode"`
	RankedStatus       byte `db:"ranked_status"`
	GradeAchievedOsu   byte `db:"grade_achieved_osu"`
	GradeAchievedTaiko byte `db:"grade_achieved_taiko"`
	GradeAchievedCTB   byte `db:"grade_achieved_ctb"`
	GradeAchievedMania byte `db:"grade_achieved_mania"`
	ManiaScrollSpeed   byte `db:"mania_scroll_speed"`

	Unplayed bool `db:"unplayed"`
}

Beatmap is a single difficulty within a BeatmapSet. Mirrors the beatmaps table. MD5Hash is the change-detection key: any edit to the .osu file changes it, which is how we know a difficulty needs its Skills recomputed.

type BeatmapSet

type BeatmapSet struct {
	BeatmapSetID  int32  `db:"beatmap_set_id"`
	SongTitle     string `db:"song_title"`
	SongTitleUni  string `db:"song_title_uni"`
	ArtistName    string `db:"artist_name"`
	ArtistNameUni string `db:"artist_name_uni"`
	CreatorName   string `db:"creator_name"`
	SongSource    string `db:"song_source"`
	SongTags      string `db:"song_tags"`
}

BeatmapSet is one mapset — a group of Beatmap difficulties sharing the same song. Mirrors the beatmapsets table 1:1.

type MD5Hash

type MD5Hash [16]byte

MD5Hash stores an MD5 digest as raw bytes rather than a 32-character hex string — halves storage per row (16 bytes vs 32) and makes index/equality comparisons operate on raw bytes instead of ASCII text. Comparable with == since it's a fixed-size array.

func MustParseMD5Hash

func MustParseMD5Hash(hexStr string) MD5Hash

MustParseMD5Hash is ParseMD5Hash but panics on error — use only where the input is already known-good (e.g. constants in tests).

func ParseMD5Hash

func ParseMD5Hash(hexStr string) (MD5Hash, error)

ParseMD5Hash decodes a 32-character hex string (as found in osu!.db / osu.DatabaseBeatmap.MD5Hash) into an MD5Hash.

func (*MD5Hash) Scan

func (h *MD5Hash) Scan(src any) error

Scan implements sql.Scanner so sqlx/database-sql reads a BLOB column directly into this type.

func (MD5Hash) String

func (h MD5Hash) String() string

func (MD5Hash) Value

func (h MD5Hash) Value() (driver.Value, error)

Value implements driver.Valuer so sqlx/database-sql writes this as a BLOB automatically.

type SkillCache

type SkillCache struct {
	BeatmapID int32   `db:"beatmap_id"`
	Mods      int32   `db:"mods"`
	MD5Hash   MD5Hash `db:"md5_hash"`

	Stamina   float64 `db:"stamina"`
	Tenacity  float64 `db:"tenacity"`
	Agility   float64 `db:"agility"`
	Precision float64 `db:"precision"`
	Reading   float64 `db:"reading"`
	Memory    float64 `db:"memory"`
	Accuracy  float64 `db:"accuracy"`
	Reaction  float64 `db:"reaction"`
}

SkillCache is one (Beatmap, mod combination) pair's computed Skills. MD5Hash is copied from the owning Beatmap at compute time so staleness can be checked without a join.

Jump to

Keyboard shortcuts

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