data

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(dataSourceName string) (*sql.DB, error)

Types

type LeaderboardRepository

type LeaderboardRepository struct {
	// contains filtered or unexported fields
}

func NewLeaderboardRepository

func NewLeaderboardRepository(db *sql.DB) *LeaderboardRepository

func (*LeaderboardRepository) All

func (r *LeaderboardRepository) All(gameMode string) ([]Score, error)

func (*LeaderboardRepository) Save

func (r *LeaderboardRepository) Save(score *Score) (int, error)

Save saves a score to the leaderboard and returns the ID of the new score.

type Score

type Score struct {
	ID       int
	Rank     int
	GameMode string
	Name     string
	Time     time.Duration
	Score    int
	Lines    int
	Level    int
}

Jump to

Keyboard shortcuts

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