entities

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 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"
	SetupConditionMixed   SetupCondition = "mixed"
	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 PitStrat

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

type RaceClass

type RaceClass = string

type RaceInfo

type RaceInfo struct {
	TankCapacity float64 `json:"tank_capacity,omitempty" validate:"lt=100000"`
	FuelUse      float64 `json:"fuel_use"                validate:"required,gt=0,lt=100000"`
	EnergyUse    float64 `json:"energy_use,omitempty"    validate:"required_without=TankCapacity,lt=100000"`
	RaceTime     int64   `json:"race_time"               validate:"gt=0,lt=172800000"`           // less than 48hrs
	Laptime      int64   `json:"laptime"                 validate:"required,gt=9999,lt=6000000"` // less than 100mnts
	PitLength    int64   `json:"pit_length"              validate:"lt=1000000"`
}

type RaceProgress

type RaceProgress struct {
	RemainingTime float64 `json:"remaining_time" validate:"lt:172800000,required_without=LapsComplete"` // less than 48 hrs
	LapsComplete  float64 `json:"laps_complete"  validate:"lt:100000"`
	FuelTank      float64 `json:"fuel_tank"      validate:"lt:100000"`
	EnergyTank    float64 `json:"energy_tank"    validate:"lt:100000"`
}

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"`
	TrackLayoutID *uuid.UUID     `json:"track_layout_id"`
	FileName      string         `json:"file_name"              validate:"required"`
	FileContent   string         `json:"file_content,omitempty" validate:"required_without=ID"`
	Laptime       string         `json:"laptime"                validate:"custom_laptime_validation"`
	Type          SetupType      `json:"type"                   validate:"required,oneof=sprint endurance hotlap"`
	Condition     SetupCondition `json:"condition"              validate:"required,oneof=dry damp wet flooded mixed"`
	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"`
}

TODO(slax0rr): add custom validation to check the track layout id against the stored layout data

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 {
	StintNumber   uint    `json:"stint_number"             validate:"required"`
	Laps          float64 `json:"laps"                     validate:"required,gt=0"`
	Save          float64 `json:"save,omitempty"`
	TargetUse     FuelReq `json:"target_use"               validate:"required"`
	StintRequired FuelReq `json:"stint_required"           validate:"required"`
	FuelRatio     float64 `json:"fuel_ratio"               validate:"required"`
	PitLength     int64   `json:"pit_length"               validate:"required"`
	Complete      bool    `json:"complete,omitempty"`
	CompletedLaps float64 `json:"completed_laps,omitempty"`
	Locked        bool    `json:"-"`
}

type StintAdjustment

type StintAdjustment struct {
	StintNumber uint                `json:"stint_number"              validate:"required,gt=0"`
	Type        StintAdjustmentType `json:"type"`
	Laps        float64             `json:"laps,omitempty"`
	PitLength   int64               `json:"pit_length,omitempty"`
}

type StintAdjustmentType

type StintAdjustmentType = string
var (
	StintAdjustmentType_PitLength StintAdjustmentType = "pitlength"
	StintAdjustmentType_Laps      StintAdjustmentType = "laps"
)

type StratType

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

type Strategy

type Strategy struct {
	ID               uuid.UUID         `json:"id"`
	UserID           uuid.UUID         `json:"-"`
	Passphrase       string            `json:"passphrase,omitempty"`
	Name             string            `json:"name"                     validate:"required"`
	Data             StrategyData      `json:"data"                     validate:"required"`
	Progress         *RaceProgress     `json:"race_progress,omitempty"`
	StintAdjustments []StintAdjustment `json:"-"`
	CreatedAt        time.Time         `json:"-"`
	UpdatedAt        *time.Time        `json:"-"`
}

type StrategyData

type StrategyData struct {
	RaceInfo     RaceInfo `json:"race_info"            validate:"required"`
	Laps         float64  `json:"laps"                 validate:"required,gt=0"`
	SafeLaps     float64  `json:"safe_laps"            validate:"required,gt=0"`
	MinRequired  FuelReq  `json:"min_required"         validate:"required"`
	SafeRequired FuelReq  `json:"safe_required"        validate:"required"`
	FuelRatio    float64  `json:"fuel_ratio,omitempty"`
	PitStrategy  PitStrat `json:"pit_strategy"         validate:"required"`
}

type StrategyInfo

type StrategyInfo 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 StrategyList

type StrategyList []Strategy

type Track

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

type TrackLayout

type TrackLayout struct {
	ID        uuid.UUID  `json:"id"`
	TrackID   uuid.UUID  `json:"track_id"`
	Name      string     `json:"name"`
	Default   bool       `json:"default"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt *time.Time `json:"-"`
}

type TrackLayoutList

type TrackLayoutList []TrackLayout

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