Documentation
¶
Index ¶
- type AddTracklistParams
- type Store
- func (s *Store) AddTracklist(ctx context.Context, model *AddTracklistParams) (*Tracklist, error)
- func (s *Store) GetTracklist(ctx context.Context, id string) (*Tracklist, error)
- func (s *Store) GetTracklists(ctx context.Context, page, limit int64) ([]*Tracklist, int64, error)
- func (s *Store) GetTracklistsByTrack(ctx context.Context, id string, page, limit int64) ([]*Tracklist, int64, error)
- func (s *Store) UpdateTracklist(ctx context.Context, id string, model *UpdateTracklistParams) (*Tracklist, error)
- type Tracklist
- type UpdateTracklistParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddTracklistParams ¶
type AddTracklistParams struct { Name string `json:"name"` Date string `json:"date"` URL string `json:"url"` Artwork string `json:"artwork"` Tracks [][]string `json:"tracks"` }
AddTracklistParams are the parameters deserialised from JSON for adding a new tracklist.
func (*AddTracklistParams) ToDatabaseParams ¶
func (t *AddTracklistParams) ToDatabaseParams() db.AddTracklistParams
ToDatabaseParams returns a database params struct for adding a new tracklist.
func (*AddTracklistParams) Validate ¶
func (t *AddTracklistParams) Validate() valid.Error
Validate validate that the data provided is correct for adding a new tracklist.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a store for interacting with tracklists in the data store.
func (*Store) AddTracklist ¶
AddTracklist adds the tracklist. If the data is not valid returns an unprocessable entity error.
func (*Store) GetTracklist ¶
GetTracklist returns a tracklist with the given ID. If no tracklist exists return a not found error.
func (*Store) GetTracklists ¶
GetTracklists returns a list of tracklists. The list is paginated based on the page and limit arguments.
func (*Store) GetTracklistsByTrack ¶
func (s *Store) GetTracklistsByTrack(ctx context.Context, id string, page, limit int64) ([]*Tracklist, int64, error)
GetTracklistsByTrack returns a list of tracklists that contain the track witht he given ID. The list is paginated based on the page and limit arguments.
func (*Store) UpdateTracklist ¶
func (s *Store) UpdateTracklist(ctx context.Context, id string, model *UpdateTracklistParams) (*Tracklist, error)
UpdateTracklist uupdates the tracklist with the given ID. If the data is not valid returns an unprocessable entity error. If the tracklist does not exist returns a not found error.
type Tracklist ¶
type Tracklist struct { ID string `json:"id"` Name string `json:"name"` Date time.Time `json:"date"` URL string `json:"url"` Artwork string `json:"artwork"` Created time.Time `json:"-"` Updated time.Time `json:"-"` Tracks []*trackstore.Track `json:"tracks,omitempty"` TrackCount int `json:"trackCount"` }
Tracklist is the model used for serialising a tracklist to JSON.
type UpdateTracklistParams ¶
type UpdateTracklistParams struct { Name string `json:"name"` Date string `json:"date"` URL string `json:"url"` }
UpdateTracklistParams are the parameters deserialised from JSON for updating an existing tracklist.
func (*UpdateTracklistParams) ToDatabaseParams ¶
func (t *UpdateTracklistParams) ToDatabaseParams(id string) db.UpdateTracklistParams
ToDatabaseParams returns a database params struct for updating an existing tracklist.
func (*UpdateTracklistParams) Validate ¶
func (t *UpdateTracklistParams) Validate() valid.Error
Validate validates that the data provided is correct for updating an existing tracklist.