Documentation ¶
Index ¶
- func WeekStart(reference time.Time) time.Time
- type Adapter
- type Car
- type Club
- type Database
- type Driver
- type FastestLaptime
- type Laptime
- type Points
- type PostgresAdapter
- type RaceResult
- type RaceStats
- type RaceWeek
- type RaceWeekMetrics
- type RaceWeekResult
- type Season
- type SeasonMetrics
- type Series
- type Summary
- type TimeRanking
- type TimeTrialResult
- type Track
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter interface { GetDatabase() *sqlx.DB GetURI() string GetType() string RunMigrations(string) error }
func NewAdapter ¶
func NewAdapter() (adapter Adapter)
type Car ¶
type Car struct { CarID int `db:"pk_car_id"` Name string `db:"name"` Description string `db:"description"` Model string `db:"model"` Make string `db:"make"` PanelImage string `db:"panel_image"` LogoImage string `db:"logo_image"` CarImage string `db:"car_image"` Abbreviation string `db:"abbreviation"` Free bool `db:"free_with_subscription"` Retired bool `db:"retired"` }
type Database ¶
type Database interface { GetSeries() ([]Series, error) GetActiveSeries() ([]Series, error) GetSeasons() ([]Season, error) GetSeasonsBySeriesID(int) ([]Season, error) GetSeasonsByAPISeriesID(int) ([]Season, error) GetSeasonByID(int) (Season, error) UpsertSeason(Season) error UpsertTrack(Track) error UpsertCar(Car) error GetCarByID(int) (Car, error) GetCarsByRaceWeekID(int) ([]Car, error) GetCarClassIDsByRaceWeekID(int) ([]int, error) UpsertTimeTrialResult(TimeTrialResult) error GetTimeTrialResultsBySeasonIDAndWeek(int, int) ([]TimeTrialResult, error) GetTimeTrialResultsBySeasonIDWeekAndCarClass(int, int, int) ([]TimeTrialResult, error) UpsertTimeRanking(TimeRanking) error GetTimeRankingsBySeasonIDAndWeek(int, int) ([]TimeRanking, error) GetFastestTimeTrialSessionsBySeasonIDAndWeek(int, int) ([]FastestLaptime, error) GetFastestRaceLaptimesBySeasonIDAndWeek(int, int) ([]FastestLaptime, error) InsertRaceWeek(RaceWeek) (RaceWeek, error) UpdateRaceWeekLastUpdateToNow(int) error GetRaceWeekByID(int) (RaceWeek, error) GetRaceWeekBySeasonIDAndWeek(int, int) (RaceWeek, error) GetRaceWeekMetricsBySeasonID(int) ([]RaceWeekMetrics, error) GetRaceWeekMetricsBySeasonIDAndWeek(int, int) (RaceWeekMetrics, error) InsertRaceWeekResult(RaceWeekResult) (RaceWeekResult, error) GetRaceWeekResultBySubsessionID(int) (RaceWeekResult, error) GetRaceWeekResultsBySeasonIDAndWeek(int, int) ([]RaceWeekResult, error) InsertRaceStats(RaceStats) (RaceStats, error) GetRaceStatsBySubsessionID(int) (RaceStats, error) GetSeasonMetricsBySeriesID(int) ([]SeasonMetrics, error) UpsertClub(Club) error UpsertDriver(Driver) error InsertRaceResult(RaceResult) (RaceResult, error) GetRaceResultBySubsessionIDAndDriverID(int, int) (RaceResult, error) GetRaceResultsBySubsessionID(int) ([]RaceResult, error) GetRaceResultsBySeasonIDAndWeek(int, int) ([]RaceResult, error) GetPointsBySeasonIDAndWeek(int, int) ([]Points, error) GetPointsBySeasonIDAndWeekAndTrackCategory(int, int, string) ([]Points, error) GetDriverSummariesBySeasonIDAndWeek(int, int) ([]Summary, error) GetDriverSummariesBySeasonIDAndWeekAndTeam(int, int, string) ([]Summary, error) GetDriverSummariesBySeasonIDAndTeam(int, string) ([]Summary, error) GetClubByID(int) (Club, error) GetDriverByID(int) (Driver, error) GetTrackByID(int) (Track, error) }
func NewDatabase ¶
type FastestLaptime ¶
func (FastestLaptime) String ¶
func (r FastestLaptime) String() string
type Points ¶
type PostgresAdapter ¶
func (*PostgresAdapter) GetDatabase ¶
func (adapter *PostgresAdapter) GetDatabase() *sqlx.DB
func (*PostgresAdapter) GetType ¶
func (adapter *PostgresAdapter) GetType() string
func (*PostgresAdapter) GetURI ¶
func (adapter *PostgresAdapter) GetURI() string
func (*PostgresAdapter) RunMigrations ¶
func (adapter *PostgresAdapter) RunMigrations(basePath string) error
type RaceResult ¶
type RaceResult struct { SubsessionID int `db:"fk_subsession_id"` // foreign-key to RaceWeekResult.SubsessionID Driver Driver IRatingBefore int `db:"old_irating"` IRatingAfter int `db:"new_irating"` LicenseLevelBefore int `db:"old_license_level"` LicenseLevelAfter int `db:"new_license_level"` SafetyRatingBefore int `db:"old_safety_rating"` SafetyRatingAfter int `db:"new_safety_rating"` CPIBefore float64 `db:"old_cpi"` CPIAfter float64 `db:"new_cpi"` AggregateChampPoints int `db:"aggregate_champpoints"` ChampPoints int `db:"champpoints"` ClubPoints int `db:"clubpoints"` CarID int `db:"fk_car_id"` CarClassID int `db:"car_class_id"` StartingPosition int `db:"starting_position"` Position int `db:"position"` FinishingPosition int `db:"finishing_position"` FinishingPositionInClass int `db:"finishing_position_in_class"` Division int `db:"division"` Interval int `db:"interval"` ClassInterval int `db:"class_interval"` AvgLaptime Laptime `db:"avg_laptime"` BestLaptime Laptime `db:"best_laptime"` LapsCompleted int `db:"laps_completed"` LapsLead int `db:"laps_lead"` Incidents int `db:"incidents"` ReasonOut string `db:"reason_out"` SessionStartTime int64 `db:"session_starttime"` }
func (RaceResult) String ¶
func (rr RaceResult) String() string
type RaceStats ¶
type RaceStats struct { SubsessionID int `db:"fk_subsession_id"` // foreign-key to RaceWeekResult.SubsessionID StartTime time.Time `db:"starttime"` SimulatedStartTime time.Time `db:"simulated_starttime"` LeadChanges int `db:"lead_changes"` Laps int `db:"laps"` Cautions int `db:"cautions"` CautionLaps int `db:"caution_laps"` CornersPerLap int `db:"corners_per_lap"` AvgLaptime Laptime `db:"avg_laptime"` AvgQualiLaps int `db:"avg_quali_laps"` WeatherRH int `db:"weather_rh"` WeatherTemp int `db:"weather_temp"` }
type RaceWeekMetrics ¶
type RaceWeekMetrics struct { SeasonID int `db:"season_id"` // foreign-key to Season.SeasonID RaceWeek int `db:"raceweek"` TimeOfDay time.Time `db:"time_of_day"` Laps int `db:"laps"` AvgCautions int `db:"avg_cautions"` AvgLaptime Laptime `db:"avg_laptime"` FastestLaptime Laptime `db:"fastest_laptime"` MaxSOF int `db:"max_sof"` MinSOF int `db:"min_sof"` AvgSOF int `db:"avg_sof"` AvgSize int `db:"avg_size"` }
type RaceWeekResult ¶
type RaceWeekResult struct { RaceWeekID int `db:"fk_raceweek_id"` // foreign-key to RaceWeek.RaceWeekID StartTime time.Time `db:"starttime"` TrackID int `db:"fk_track_id"` // foreign-key to Track.TrackID SessionID int `db:"session_id"` SubsessionID int `db:"subsession_id"` Official bool `db:"official"` SizeOfField int `db:"size"` StrengthOfField int `db:"sof"` }
type Season ¶
type Season struct { SeriesID int `db:"fk_series_id"` // foreign-key to Series.SeriesID SeasonID int `db:"pk_season_id"` Year int `db:"year"` Quarter int `db:"quarter"` Category string `db:"category"` SeasonName string `db:"name"` SeasonNameShort string `db:"short_name"` BannerImage string `db:"banner_image"` PanelImage string `db:"panel_image"` LogoImage string `db:"logo_image"` Timeslots string `db:"timeslots"` StartDate time.Time `db:"startdate"` SeriesColorScheme string `db:"series_colorscheme"` // data from Series.ColorScheme }
type SeasonMetrics ¶
type SeasonMetrics struct { SeriesID int `db:"series_id"` // foreign-key to Series.SeriesID Year int `db:"year"` Quarter int `db:"quarter"` Timeslots string `db:"timeslots"` Weeks int `db:"weeks"` Sessions int `db:"nof_sessions"` AvgSize int `db:"avg_size"` AvgSOF int `db:"avg_sof"` Drivers int `db:"nof_drivers"` UniqueDrivers int `db:"nof_unique_drivers"` UniqueRoadDrivers int `db:"nof_unique_road_drivers"` UniqueCommittedRoadOnlyDrivers int `db:"nof_unique_committed_road_only_drivers"` UniqueOvalDrivers int `db:"nof_unique_oval_drivers"` UniqueCommittedOvalOnlyDrivers int `db:"nof_unique_committed_oval_only_drivers"` UniqueBothDrivers int `db:"nof_unique_both_drivers"` UniqueEightWeeksDrivers int `db:"nof_unique_eight_weeks_drivers"` UniqueFullSeasonDrivers int `db:"nof_unique_full_season_drivers"` }
type Series ¶
type Series struct { SeriesID int `db:"pk_series_id"` SeriesName string `db:"name"` SeriesNameShort string `db:"short_name"` SeriesRegex string `db:"regex"` ColorScheme string `db:"colorscheme"` Active string `db:"active"` APISeriesID int `db:"api_series_id"` CurrentSeason string `db:"current_season"` CurrentSeasonID int `db:"current_season_id"` CurrentWeek int `db:"current_week"` }
type Summary ¶
type Summary struct { Driver Driver Division int HighestIRatingGain int TotalIRatingGain int TotalSafetyRatingGain int AverageIncidentsPerLap float64 LapsCompleted int LapsLead int Poles int Wins int Podiums int Top5 int TotalPositionsGained int AverageChampPoints int HighestChampPoints int TotalClubPoints int NumberOfRaces int }
type TimeRanking ¶
type TimeRanking struct { Driver Driver RaceWeek RaceWeek Car Car TimeTrialSubsessionID int `db:"time_trial_subsession_id"` TimeTrialFastestLap Laptime `db:"time_trial_fastest_lap"` TimeTrial Laptime `db:"time_trial"` Race Laptime `db:"race"` LicenseClass string `db:"license_class"` IRating int `db:"irating"` }
func (TimeRanking) String ¶
func (r TimeRanking) String() string
type TimeTrialResult ¶
type TimeTrialResult struct { RaceWeek RaceWeek Driver Driver CarClassID int `db:"car_class_id"` Rank int `db:"rank"` Position int `db:"pos"` Points int `db:"points"` Starts int `db:"starts"` Wins int `db:"wins"` Weeks int `db:"week"` Dropped int `db:"dropped"` Division int `db:"division"` }
func (TimeTrialResult) String ¶
func (t TimeTrialResult) String() string
type Track ¶
type Track struct { TrackID int `db:"pk_track_id"` Name string `db:"name"` Config string `db:"config"` Category string `db:"category"` Free bool `db:"free_with_subscription"` Retired bool `db:"retired"` IsDirt bool `db:"is_dirt"` IsOval bool `db:"is_oval"` BannerImage string `db:"banner_image"` PanelImage string `db:"panel_image"` LogoImage string `db:"logo_image"` MapImage string `db:"map_image"` ConfigImage string `db:"config_image"` }
Click to show internal directories.
Click to hide internal directories.