models

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CarClassLMH  CarClass = "LMH"
	CarClassLMDh CarClass = "LMDh"
	CarClassP2   CarClass = "P2"
	CarClassGTE  CarClass = "GTE"
	CarClassGT3  CarClass = "GT3"

	RaceClassHypercar = "HYPERCAR"
	RaceClassLMP2     = "LMP2"
	RaceClassLMGTE    = "LMGTE"
	RaceClassLMGT3    = "LMGT3"
)
View Source
const (
	SetupTypeSprint    SetupType = "sprint"
	SetupTypeEndurance SetupType = "endurance"
	SetupTypeHotlap    SetupType = "hotlap"

	SetupConditionDry     SetupCondition = "dry"
	SetupConditionDamp    SetupCondition = "damp"
	SetupConditionWet     SetupCondition = "wet"
	SetupConditionFlooded SetupCondition = "flooded"

	SetupVote_Upvote   SetupVote = "upvote"
	SetupVote_Downvote SetupVote = "downvote"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Car

type Car struct {
	ID           uuid.UUID  `json:"id"`
	Class        CarClass   `json:"class"`
	RaceClass    RaceClass  `json:"race_class"`
	Manufacturer string     `json:"manufacturer"`
	Model        string     `json:"model"`
	Spec         *string    `json:"spec,omitempty"`
	Year         uint       `json:"year"`
	CreatedAt    time.Time  `json:"-"`
	UpdatedAt    *time.Time `json:"-"`
}

type CarClass

type CarClass = string

type CarList

type CarList []Car

type FuelReq

type FuelReq struct {
	Fuel   float64 `json:"fuel"`
	Energy float64 `json:"energy,omitempty"`
}

type PitReqCarInfo

type PitReqCarInfo struct {
	TankCapacity float64 `json:"tank_capacity,omitempty"`
	FuelUse      float64 `json:"fuel_use"`
	EnergyUse    float64 `json:"energy_use,omitempty"`
	RaceTime     int64   `json:"race_time"`
	Laptime      int64   `json:"laptime"`
	PitLength    int64   `json:"pit_length"`
}

type PitRequirement

type PitRequirement struct {
	Laps         float64    `json:"laps"`
	SafeLaps     float64    `json:"safe_laps"`
	MinRequired  FuelReq    `json:"min_required"`
	SafeRequired FuelReq    `json:"safe_required"`
	FuelRatio    float64    `json:"fuel_ratio,omitempty"`
	Strategies   []PitStrat `json:"strategies"`
	RecommStrat  StratType  `json:"recomm_strat"`
}

type PitStrat

type PitStrat struct {
	Type   StratType `json:"type"`
	Stops  int       `json:"stops"`
	Stints []Stint   `json:"stints"`
}

type RaceClass

type RaceClass = string

type Setup

type Setup struct {
	ID          uuid.UUID      `json:"id"                     validate:"uuid"`
	CarID       uuid.UUID      `json:"car_id"                 validate:"required,uuid"`
	TrackID     uuid.UUID      `json:"track_id"               validate:"required,uuid"`
	FileName    string         `json:"file_name"              validate:"required"`
	FileContent string         `json:"file_content,omitempty"`
	Laptime     string         `json:"laptime"                validate:"required,custom_laptime_validation"`
	Type        SetupType      `json:"type"                   validate:"required,oneof=sprint endurance hotlap"`
	Condition   SetupCondition `json:"condition"              validate:"required,oneof=dry damp wet flooded"`
	Rating      int64          `json:"rating"                 validate:"eq=0"`
	Description *string        `json:"description,omitempty"`
	Downloads   int            `json:"downloads"              validate:"eq=0"`
	VideoLink   string         `json:"video_link,omitempty"   validate:"omitempty,http_url"`
	Version     string         `json:"version"`
	UserID      uuid.UUID      `json:"user_id"                validate:"required,uuid"`
	User        string         `json:"display_name"           validate:"required"`
	UserVote    *bool          `json:"user_vote""`
	CreatedAt   time.Time      `json:"uploaded_at"`
	UpdatedAt   *time.Time     `json:"modified,omitempty"`
}

type SetupCondition

type SetupCondition = string

type SetupFile

type SetupFile struct {
	ID        uuid.UUID  `json:"-"`
	SetupID   uuid.UUID  `json:"-"`
	Name      string     `json:"-"`
	Content   []byte     `json:"-"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt *time.Time `json:"-"`

	// TODO(slax0rr): remove the legacy setup file parameters
	Path string `json:"-"`
}

type SetupList

type SetupList []Setup

type SetupType

type SetupType = string

type SetupVote

type SetupVote = string

type Stint

type Stint struct {
	Laps          float64 `json:"laps"`
	Save          float64 `json:"save,omitempty"`
	TargetUse     FuelReq `json:"target_use"`
	StintRequired FuelReq `json:"stint_required"`
	FuelRatio     float64 `json:"fuel_ratio"`
}

type StratType

type StratType = string
var (
	StratType_FlatOut  StratType = "flat_out"
	StratType_FuelSave StratType = "fuel_save"
	StratType_NoStop   StratType = "no_stop"
)

type Track

type Track struct {
	ID        uuid.UUID  `json:"id"`
	Country   string     `json:"country"`
	TrackName string     `json:"track_name"`
	Year      int        `json:"year"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt *time.Time `json:"-"`
}

type TrackList

type TrackList []Track

type User

type User struct {
	ID          uuid.UUID `json:"id"`
	Email       string    `json:"email,omitempty"`
	Username    string    `json:"username,omitempty"`
	DisplayName string    `json:"display_name,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL