Make QueryOptions optional in PlaylistRepository.GetStarred
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ type PlaylistRepository interface {
|
|||||||
BaseRepository
|
BaseRepository
|
||||||
Put(m *Playlist) error
|
Put(m *Playlist) error
|
||||||
Get(id string) (*Playlist, error)
|
Get(id string) (*Playlist, error)
|
||||||
GetAll(options QueryOptions) (Playlists, error)
|
GetAll(options ...QueryOptions) (Playlists, error)
|
||||||
PurgeInactive(active Playlists) ([]string, error)
|
PurgeInactive(active Playlists) ([]string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,17 @@ func (r *playlistRepository) Get(id string) (*domain.Playlist, error) {
|
|||||||
return rec.(*domain.Playlist), err
|
return rec.(*domain.Playlist), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *playlistRepository) GetAll(options domain.QueryOptions) (domain.Playlists, error) {
|
func (r *playlistRepository) GetAll(options ...domain.QueryOptions) (domain.Playlists, error) {
|
||||||
var as = make(domain.Playlists, 0)
|
o := domain.QueryOptions{}
|
||||||
if options.SortBy == "" {
|
if len(options) > 0 {
|
||||||
options.SortBy = "Name"
|
o = options[0]
|
||||||
options.Alpha = true
|
|
||||||
}
|
}
|
||||||
err := r.loadAll(&as, options)
|
var as = make(domain.Playlists, 0)
|
||||||
|
if o.SortBy == "" {
|
||||||
|
o.SortBy = "Name"
|
||||||
|
o.Alpha = true
|
||||||
|
}
|
||||||
|
err := r.loadAll(&as, o)
|
||||||
return as, err
|
return as, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ func (r *playlistRepository) Get(id string) (*domain.Playlist, error) {
|
|||||||
return &a, err
|
return &a, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *playlistRepository) GetAll(options domain.QueryOptions) (domain.Playlists, error) {
|
func (r *playlistRepository) GetAll(options ...domain.QueryOptions) (domain.Playlists, error) {
|
||||||
var all []_Playlist
|
var all []_Playlist
|
||||||
err := r.getAll(&all)
|
err := r.getAll(&all, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user