Player12
An open source football management simulator
Loading...
Searching...
No Matches
FixtureRepository Class Reference

Repository class for managing Match and Calendar entities in the database, plus the per-fixture match reports. More...

#include <fixture_repository.h>

Public Member Functions

 FixtureRepository (std::shared_ptr< DatabaseConnection > db_conn)
 Construct a new Fixture Repository object.
 
std::vector< Match > loadAllMatches () const
 Load all matches from the database.
 
void insertFixture (const Match &match) const
 Insert a match fixture into the database.
 
void saveCalendar (const Calendar &calendar) const
 Save the calendar to the database.
 
void loadCalendar (Calendar &calendar) const
 Load the calendar from the database.
 
void saveMatchReports (const std::vector< MatchReport > &reports) const
 Inserts or replaces match reports (keyed by date and teams).
 
std::optional< MatchReport > loadMatchReport (const GameDateValue &date, TeamID home_id, TeamID away_id) const
 Loads the report of one fixture, if it was stored.
 
std::vector< MatchReport > loadTeamMatchReports (uint16_t season, TeamID team_id) const
 Loads all stored reports of a team in a season, by date.
 

Private Attributes

std::shared_ptr< DatabaseConnection > db_conn
 

Detailed Description

Repository class for managing Match and Calendar entities in the database, plus the per-fixture match reports.

Constructor & Destructor Documentation

◆ FixtureRepository()

FixtureRepository::FixtureRepository ( std::shared_ptr< DatabaseConnection >  db_conn)
explicit

Construct a new Fixture Repository object.

Parameters
db_connShared pointer to the database connection.

Member Function Documentation

◆ insertFixture()

void FixtureRepository::insertFixture ( const Match &  match) const

Insert a match fixture into the database.

Parameters
matchThe Match object to insert.

◆ loadAllMatches()

std::vector< Match > FixtureRepository::loadAllMatches ( ) const

Load all matches from the database.

Returns
A vector of Match objects.

◆ loadCalendar()

void FixtureRepository::loadCalendar ( Calendar &  calendar) const

Load the calendar from the database.

Parameters
calendarThe Calendar object to populate.

◆ loadMatchReport()

std::optional< MatchReport > FixtureRepository::loadMatchReport ( const GameDateValue &  date,
TeamID  home_id,
TeamID  away_id 
) const

Loads the report of one fixture, if it was stored.

◆ loadTeamMatchReports()

std::vector< MatchReport > FixtureRepository::loadTeamMatchReports ( uint16_t  season,
TeamID  team_id 
) const

Loads all stored reports of a team in a season, by date.

◆ saveCalendar()

void FixtureRepository::saveCalendar ( const Calendar &  calendar) const

Save the calendar to the database.

Parameters
calendarThe Calendar object to save.

◆ saveMatchReports()

void FixtureRepository::saveMatchReports ( const std::vector< MatchReport > &  reports) const

Inserts or replaces match reports (keyed by date and teams).

Member Data Documentation

◆ db_conn

std::shared_ptr<DatabaseConnection> FixtureRepository::db_conn
private

The documentation for this class was generated from the following files: