2024-05-23 04:18:54 +00:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/uptrace/bun"
|
|
|
|
|
|
|
|
"git.lehouerou.net/laurent/sorarebuddy/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Client struct {
|
|
|
|
db *bun.DB
|
|
|
|
|
|
|
|
CardSupplies *CardSupplyRepository
|
|
|
|
Memberships *MembershipRepository
|
|
|
|
Countries *CountryRepository
|
|
|
|
Fixtures *FixtureRepository
|
|
|
|
Competitions *CompetitionRepository
|
|
|
|
Teams *TeamRepository
|
|
|
|
Games *GameRepository
|
|
|
|
Players *PlayerRepository
|
|
|
|
GamePlayers *GamePlayerRepository
|
|
|
|
GamePlayerScores *Repository[model.GamePlayerScore]
|
|
|
|
Zones *ZoneRepository
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewClient(db *bun.DB) *Client {
|
|
|
|
return &Client{
|
|
|
|
db: db,
|
|
|
|
CardSupplies: NewCardSupplyRepository(db),
|
|
|
|
Memberships: NewMembershipRepository(db),
|
|
|
|
Countries: NewCountryRepository(db),
|
|
|
|
Fixtures: NewFixtureRepository(db),
|
|
|
|
Competitions: NewCompetitionRepository(db),
|
|
|
|
Teams: NewTeamRepository(db),
|
|
|
|
Games: NewGameRepository(db),
|
|
|
|
Players: NewPlayerRepository(db),
|
|
|
|
GamePlayers: NewGamePlayerRepository(db),
|
2024-06-06 05:52:54 +00:00
|
|
|
GamePlayerScores: NewRepository[model.GamePlayerScore](db, []string{"game_id", "player_slug", "game_date"}),
|
2024-05-23 04:18:54 +00:00
|
|
|
Zones: NewZoneRepository(db),
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|