persistence

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ForeignKeyConstraint_SetupLayoutID = "setups_layout_id_fkey"
)
View Source
const (
	PostgresRaiseExceptionErrorCode = "P0001"
)

Variables

View Source
var (
	ErrTrackAndLayoutMismatch error = fmt.Errorf("The specified layout_id does not belong to the given track_id")
)

Functions

This section is empty.

Types

type BaseRepo

type BaseRepo struct {
	// contains filtered or unexported fields
}

type Car

type Car struct {
	BaseRepo
}

func NewCar

func NewCar(dbpool *pgxpool.Pool) *Car

func (*Car) Get

func (c *Car) Get(ctx context.Context) (entities.CarList, error)

func (*Car) GetByID

func (c *Car) GetByID(ctx context.Context, id uuid.UUID) (*entities.Car, error)

type PitInfo

type PitInfo struct {
	BaseRepo
}

func NewPitInfo

func NewPitInfo(dbpool *pgxpool.Pool) *PitInfo

func (*PitInfo) GetAveragePitTimeLoss

func (p *PitInfo) GetAveragePitTimeLoss(ctx context.Context) (float64, error)

func (*PitInfo) GetPitTimeLoss

func (p *PitInfo) GetPitTimeLoss(
	ctx context.Context,
	raceClass entities.RaceClass,
	trackID uuid.UUID,
	layoutID *uuid.UUID,
) (*entities.PitTimeLoss, error)

func (*PitInfo) GetServiceDurations

func (p *PitInfo) GetServiceDurations(
	ctx context.Context,
	raceClass entities.RaceClass,
) (entities.PitServiceDurations, error)

type Setup

type Setup struct {
	BaseRepo
}

func NewSetup

func NewSetup(dbpool *pgxpool.Pool) *Setup

func (*Setup) Count

func (s *Setup) Count(ctx context.Context, opts ...postgresdb.ExecOption) (int64, error)

func (*Setup) Create

func (s *Setup) Create(ctx context.Context, setup *entities.Setup, opts ...postgresdb.ExecOption) error

func (*Setup) GetList

func (s *Setup) GetList(
	ctx context.Context,
	userID uuid.UUID,
	opts ...postgresdb.ExecOption,
) (entities.SetupList, error)

func (*Setup) IncrementDownload

func (s *Setup) IncrementDownload(ctx context.Context, id uuid.UUID, opts ...postgresdb.ExecOption) error

func (*Setup) ListGroupedSetups

func (s *Setup) ListGroupedSetups(
	ctx context.Context,
	userID uuid.UUID,
	orderBy query.OrderBy,
) ([]entities.SetupGroup, error)

func (*Setup) ListUserAIGenerated

func (s *Setup) ListUserAIGenerated(ctx context.Context, setupID, userID uuid.UUID) (entities.SetupList, error)

func (*Setup) RecordVote

func (s *Setup) RecordVote(
	ctx context.Context,
	setupID, userID uuid.UUID,
	upvote bool,
	opts ...postgresdb.ExecOption,
) error

func (*Setup) Update

func (s *Setup) Update(
	ctx context.Context,
	setup *entities.Setup,
	opts ...postgresdb.ExecOption,
) (int64, error)

type SetupFile

type SetupFile struct {
	BaseRepo
}

func NewSetupFile

func NewSetupFile(dbpool *pgxpool.Pool) *SetupFile

func (*SetupFile) List

func (sf *SetupFile) List(
	ctx context.Context,
	setupID uuid.UUID,
	opts ...postgresdb.ExecOption,
) ([]entities.SetupFile, error)

func (*SetupFile) Store

func (sf *SetupFile) Store(ctx context.Context, file entities.SetupFile, opts ...postgresdb.ExecOption) error

type Strategy

type Strategy struct {
	BaseRepo
	// contains filtered or unexported fields
}

func NewStrategy

func NewStrategy(dbpool *pgxpool.Pool) *Strategy

func (*Strategy) Count

func (s *Strategy) Count(ctx context.Context, opts ...postgresdb.ExecOption) (int64, error)

func (*Strategy) Create

func (s *Strategy) Create(ctx context.Context, strategy *entities.SavedStrategy, opts ...postgresdb.ExecOption) error

func (*Strategy) GetByID

func (s *Strategy) GetByID(ctx context.Context, id uuid.UUID) (*entities.SavedStrategy, error)

func (*Strategy) GetStrategyCalculation

func (s *Strategy) GetStrategyCalculation(ctx context.Context, id uuid.UUID) (*entities.RaceStrategy, error)

func (*Strategy) List

func (*Strategy) RemoveRecalculatedStrategy

func (s *Strategy) RemoveRecalculatedStrategy(ctx context.Context, id uuid.UUID, opts ...postgresdb.ExecOption) error

func (*Strategy) StoreRecalculatedStrategy

func (s *Strategy) StoreRecalculatedStrategy(
	ctx context.Context,
	strat *entities.SavedStrategy,
	opts ...postgresdb.ExecOption,
) error

func (*Strategy) StoreStrategyCalculation

func (s *Strategy) StoreStrategyCalculation(
	ctx context.Context,
	strat *entities.RaceStrategy,
	opts ...postgresdb.ExecOption,
) error

func (*Strategy) Update

func (s *Strategy) Update(ctx context.Context, strategy *entities.SavedStrategy, opts ...postgresdb.ExecOption) error

type Track

type Track struct {
	BaseRepo
}

func NewTrack

func NewTrack(dbpool *pgxpool.Pool) *Track

func (*Track) Get

func (t *Track) Get(ctx context.Context) (entities.TrackList, error)

func (*Track) GetByID

func (t *Track) GetByID(ctx context.Context, id uuid.UUID) (*entities.Track, error)

type TrackLayout

type TrackLayout struct {
	BaseRepo
}

func NewTrackLayout

func NewTrackLayout(dbpool *pgxpool.Pool) *TrackLayout

func (*TrackLayout) Get

func (*TrackLayout) GetByID

func (t *TrackLayout) GetByID(ctx context.Context, id uuid.UUID) (*entities.TrackLayout, error)

func (*TrackLayout) GetTrackDefault

func (t *TrackLayout) GetTrackDefault(ctx context.Context, trackID uuid.UUID) (*uuid.UUID, error)

Jump to

Keyboard shortcuts

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