28 lines
824 B
Go
Raw Permalink Normal View History

2025-01-05 02:53:54 +01:00
package repo
import (
model "git.kapelle.org/niklas/beerpong-elo/internal/model"
)
type Repo interface {
2025-01-06 01:14:32 +01:00
// Add a new game to the repo. ID needs to be nil on argument. PlayerID are fetched beforehand.
AddGame(model.Game) (model.GameID, error)
2025-01-05 02:53:54 +01:00
2025-01-08 01:59:10 +01:00
// Get a game by ID. Returns nil if not found.
2025-01-06 01:14:32 +01:00
GetGame(model.GameID) (*model.Game, error)
2025-01-08 01:59:10 +01:00
// Get ID of a player. Creates one if not found.
2025-01-06 01:14:32 +01:00
GetOrCreatePlayerID(string) (model.PlayerID, error)
2025-01-08 01:59:10 +01:00
// Get player by id. Returns nil if not found.
2025-01-06 01:14:32 +01:00
GetPlayer(model.PlayerID) (*model.Player, error)
2025-01-08 01:59:10 +01:00
GetAllPlayers() ([]model.Player, error)
// Adds a game result. ID needs to be nil on argument.
2025-01-06 01:14:32 +01:00
AddGameResult(model.GameResult) (model.GameResultID, error)
2025-01-08 01:59:10 +01:00
// Get a game result by ID. Returns nil if not found.
2025-01-06 01:14:32 +01:00
GetGameResult(model.GameResultID) (*model.GameResult, error)
2025-01-05 02:53:54 +01:00
}