service

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package service provides the business logic layer for managing station data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StationService

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

StationService manages station data, including fetching, caching, and periodic refresh.

func NewStationService

func NewStationService(apiClient *api.SomaFMClient) *StationService

NewStationService creates a new StationService with the given API client.

func (*StationService) FindIndexByID

func (s *StationService) FindIndexByID(stationID string) int

func (*StationService) GetCachedStations

func (s *StationService) GetCachedStations() []station.Station

func (*StationService) GetCurrentTrackForStation

func (s *StationService) GetCurrentTrackForStation(stationID string) (string, error)

func (*StationService) GetStation

func (s *StationService) GetStation(index int) *station.Station

GetStation returns a copy of the station at the given index. Returns nil if the index is out of bounds. The returned station is a copy to prevent invalidation when the internal slice is refreshed.

func (*StationService) GetStations

func (s *StationService) GetStations() ([]station.Station, error)

func (*StationService) GetValidStationIDs

func (s *StationService) GetValidStationIDs() map[string]bool

func (*StationService) LoadImage

func (s *StationService) LoadImage(url string) (image.Image, error)

func (*StationService) StartPeriodicRefresh

func (s *StationService) StartPeriodicRefresh(interval time.Duration, callback func([]station.Station))

func (*StationService) StationCount

func (s *StationService) StationCount() int

func (*StationService) StopPeriodicRefresh

func (s *StationService) StopPeriodicRefresh()

Jump to

Keyboard shortcuts

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