Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
package model
import (
"context"
)
// TODO: Should the type be encoded in the ID?
func GetEntityByID(ctx context.Context, ds DataStore, id string) (any, error) {
ar, err := ds.Artist(ctx).Get(id)
if err == nil {
return ar, nil
}
al, err := ds.Album(ctx).Get(id)
return al, nil
pls, err := ds.Playlist(ctx).Get(id)
return pls, nil
mf, err := ds.MediaFile(ctx).Get(id)
return mf, nil
r, err := ds.Radio(ctx).Get(id)
return r, nil
return nil, err