Documentation
¶
Index ¶
- type Entry
- type FieldValidation
- type ListInput
- type MetricsEmitter
- type SaveInput
- type Service
- func (s *Service) Delete(ctx context.Context, driverID, raceID int64) error
- func (s *Service) Get(ctx context.Context, driverID, raceID int64) (*Entry, error)
- func (s *Service) List(ctx context.Context, input ListInput) ([]Entry, error)
- func (s *Service) Save(ctx context.Context, input SaveInput) (*Entry, error)
- func (s *Service) ValidateRaceExists(ctx context.Context, driverID, raceID int64) (bool, error)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
RaceID int64
CreatedAt time.Time
UpdatedAt time.Time
Notes string
Tags []string
Race *store.DriverSession
}
Entry represents a journal entry with joined race context.
type FieldValidation ¶
FieldValidation represents a validation failure for a specific field.
func ValidateTags ¶
func ValidateTags(tags []string) []FieldValidation
ValidateTags checks that tags with known prefixes have valid values. Returns validation errors for any invalid tags.
type MetricsEmitter ¶
MetricsEmitter defines the metrics interface needed by the journal service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides business logic for race journal operations.
func NewService ¶
func NewService(store Store, metrics MetricsEmitter) *Service
NewService creates a new journal service.
func (*Service) Delete ¶
Delete removes a journal entry. Idempotent - succeeds even if entry doesn't exist.
func (*Service) Get ¶
Get retrieves a single journal entry with its race context. Returns nil if the entry doesn't exist. Error is only for infrastructure failures.
func (*Service) List ¶
List retrieves journal entries within a time range, joined with race context.
type Store ¶
type Store interface {
GetDriverSession(ctx context.Context, driverID int64, startTime time.Time) (*store.DriverSession, error)
GetDriverSessions(ctx context.Context, driverID int64, startTimes []time.Time) ([]store.DriverSession, error)
SaveJournalEntry(ctx context.Context, entry store.RaceJournalEntry) error
GetJournalEntry(ctx context.Context, driverID, raceID int64) (*store.RaceJournalEntry, error)
GetJournalEntries(ctx context.Context, driverID int64, from, to time.Time) ([]store.RaceJournalEntry, error)
DeleteJournalEntry(ctx context.Context, driverID, raceID int64) error
}
Store defines the data access methods needed by the journal service.