You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
891 B
Go

package leaderboard
import (
"context"
sharedtypes "knowfoolery/backend/shared/domain/types"
)
// TopFilter narrows leaderboard list/stat queries.
type TopFilter struct {
CompletionType string
Window Window
}
// Repository defines leaderboard persistence behavior.
type Repository interface {
EnsureSchema(ctx context.Context) error
IngestEntry(ctx context.Context, entry *LeaderboardEntry) (*LeaderboardEntry, bool, error)
ListTop(ctx context.Context, filter TopFilter, limit int) ([]*LeaderboardEntry, error)
GetPlayerStats(ctx context.Context, playerID string) (*PlayerStats, error)
GetPlayerRank(ctx context.Context, playerID string) (int64, error)
ListPlayerHistory(
ctx context.Context,
playerID string,
pagination sharedtypes.Pagination,
) ([]*LeaderboardEntry, int64, error)
GetGlobalStats(ctx context.Context, filter TopFilter) (*GlobalStats, error)
}