Skip to content

Commit

Permalink
Rename the receiver object name in the radio manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ironsmile committed Oct 13, 2024
1 parent ee6f390 commit 7c665db
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/radio/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewManager(sendDBWork func(library.DatabaseExecutable) error) Stations {
}

// GetAll implements the Stations interface.
func (lib *manager) GetAll(ctx context.Context) ([]Station, error) {
func (m *manager) GetAll(ctx context.Context) ([]Station, error) {
var stations []Station
query := `
SELECT id, name, stream_url, home_page
Expand Down Expand Up @@ -81,15 +81,15 @@ func (lib *manager) GetAll(ctx context.Context) ([]Station, error) {

return nil
}
if err := lib.executeDBJobAndWait(work); err != nil {
if err := m.executeDBJobAndWait(work); err != nil {
return nil, err
}

return stations, nil
}

// Create implements the Stations interface.
func (lib *manager) Create(ctx context.Context, new Station) (int64, error) {
func (m *manager) Create(ctx context.Context, new Station) (int64, error) {
if new.Name == "" {
return 0, fmt.Errorf("name cannot be empty")
}
Expand Down Expand Up @@ -155,15 +155,15 @@ func (lib *manager) Create(ctx context.Context, new Station) (int64, error) {
return nil
}

if err := lib.executeDBJobAndWait(work); err != nil {
if err := m.executeDBJobAndWait(work); err != nil {
return 0, err
}

return lastInsertID, nil
}

// Replace implements the Stations interface.
func (lib *manager) Replace(ctx context.Context, updated Station) error {
func (m *manager) Replace(ctx context.Context, updated Station) error {
if updated.Name == "" {
return fmt.Errorf("name cannot be empty")
}
Expand Down Expand Up @@ -235,15 +235,15 @@ func (lib *manager) Replace(ctx context.Context, updated Station) error {
return nil
}

if err := lib.executeDBJobAndWait(work); err != nil {
if err := m.executeDBJobAndWait(work); err != nil {
return err
}

return nil
}

// Delete implements the Stations interface.
func (lib *manager) Delete(ctx context.Context, stationID int64) error {
func (m *manager) Delete(ctx context.Context, stationID int64) error {
query := `
DELETE FROM
radio_stations
Expand Down Expand Up @@ -273,7 +273,7 @@ func (lib *manager) Delete(ctx context.Context, stationID int64) error {
return nil
}

if err := lib.executeDBJobAndWait(work); err != nil {
if err := m.executeDBJobAndWait(work); err != nil {
return err
}

Expand Down

0 comments on commit 7c665db

Please # to comment.