db

package
v0.0.0-...-42fbbd1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSchema

func ReadSchema(path string) (string, error)

Types

type BanEntry

type BanEntry struct {
	Id   int
	Name string
}

type DataPersister

type DataPersister interface {
	Close()

	GetPlayerByGuid(guid string) (models.Player, bool)
	SaveNewPlayer(name string, guid string, ipAddress string) (int, error)
	UpdatePlayer() error
	UpdatePlayerOnJoin(guid, name, ip string, aliases []string) error
	SetPlayerRole(guid string, role int) error

	PenAdd(guid string, size float64) error
	PenSetAllAttempts(attempts int) error
	PenInitIfNotExists(guid string) error
	PenPlayerGetDailySize(guid string) (float64, error)
	PenGetAttempts(guid string) (int, error)
	PenIncrementAttempts(guid string) error
	PenDecrementAttempts(guid string) error
	PenPenOfTheDay() (string, []PenData, error)
	PenPenHallOfFame() ([]PenData, error)
	PenPenHallOfShame() ([]PenData, error)
	GetDailyPbPenCoinCount(guid string) (int, error)
	IncrementDailyPbPenCoinCount(guid string) error
	GetDailyPenRerolls(guid string) (int, error)
	IncrementDailyPenRerolls(guid string) error

	HandleRun(info models.PlayerRunInfo, checkpoints []int) (bool, error)
	GetBestCheckpoints(mapname, way string) ([]int, string, error)
	GetTopCheckpoints(mapname, way string, limit int) ([]TopCheckpoint, error)
	GetTopRunsByMapUtj(mapname, utj string, limit int) (map[string][]TopRun, error)
	GetPlayerBestsByMapUtj(guid, mapname, utj string) (map[string]TopRun, error)
	GetLatestRunsByUtj(utj string, limit int) ([]LatestRun, error)

	SetMapOptions(mapname, options string) error
	GetMapOptions(mapname string) (string, bool)
	DeleteMapOptions(mapname string) (bool, error)

	SaveGoto(mapname, jumpname string, posX, posY, posZ, angleV, angleH float64) error
	GetGoto(mapname, jumpname string) (GotoData, bool)
	GetGotoNames(mapname string) ([]string, error)
	DeleteGoto(mapname, jumpname string) (bool, error)
	DeleteAllGotos(mapname string) (int, error)

	AddIgnore(guid, ignoredGuid string) error
	RemoveIgnore(guid, ignoredGuid string) error
	GetIgnoredGuids(guid string) ([]string, error)
	GetIgnoredPlayers(guid string) ([]IgnoredPlayer, error)

	UpsertPreferences(guid string, commands []string) error
	GetPreferences(guid string) (commands []string, found bool, err error)

	AddBan(guid, ip, reason string) error
	GetBan(guid, ip string) (reason string, banned bool, err error)
	RemoveBan(playerDbId int) error
	GetBans() ([]BanEntry, error)

	GetQuoteById(id int) (int, string, error)
	GetRandomQuote() (int, string, error)
	SearchQuotes(search string) ([]QuoteEntry, error)
	SaveQuote(text string) error
	DeleteQuote(id int) error

	LookupPlayers(search string) ([]LookupResult, error)
	GetPlayerById(id int) (LookupResult, bool)
	GetPlayersByIp(ip string) ([]LookupResult, error)

	RegisterServer(ip string, port int, rconpassword string, channelId int64, name string) error
}

type GotoData

type GotoData struct {
	PosX   float64
	PosY   float64
	PosZ   float64
	AngleV float64
	AngleH float64
}

type IgnoredPlayer

type IgnoredPlayer struct {
	Id   int
	Name string
	Guid string
}

type LatestRun

type LatestRun struct {
	Mapname    string
	PlayerName string
	Runtime    int
	RunDate    string
	Way        string
}

type LookupResult

type LookupResult struct {
	Id      int
	Name    string
	Aliases string
	Role    int
	Ip      string
	Guid    string
}

type PenData

type PenData struct {
	Name sql.NullString
	Size float64
	Date time.Time
}

func (PenData) GetDate

func (p PenData) GetDate() string

func (PenData) GetName

func (p PenData) GetName() string

type QuoteEntry

type QuoteEntry struct {
	Id   int
	Text string
}

type TopCheckpoint

type TopCheckpoint struct {
	Name        string
	Runtime     int
	Checkpoints []int
}

type TopRun

type TopRun struct {
	Guid    string
	Name    string
	Runtime int
	RunDate string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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