42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
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),
|
|
GamePlayerScores: NewRepository[model.GamePlayerScore](db, []string{"game_id", "player_slug", "game_date"}),
|
|
Zones: NewZoneRepository(db),
|
|
}
|
|
|
|
}
|