use pointers to specid.ID in spec responses

a bit shit but this way we can have a nil value of ID so that the json
emitempty tag will do the thing
This commit is contained in:
sentriz
2020-05-03 05:25:00 +01:00
committed by Senan Kelly
parent 31b8b758ed
commit 950656af4f
3 changed files with 52 additions and 52 deletions

View File

@@ -49,8 +49,8 @@ type Artist struct {
AlbumCount int `sql:"-"`
}
func (a *Artist) SID() specid.ID {
return specid.ID{Type: specid.Artist, Value: a.ID}
func (a *Artist) SID() *specid.ID {
return &specid.ID{Type: specid.Artist, Value: a.ID}
}
func (a *Artist) IndexName() string {
@@ -92,16 +92,16 @@ type Track struct {
TagBrainzID string `sql:"default: null"`
}
func (t *Track) SID() specid.ID {
return specid.ID{Type: specid.Track, Value: t.ID}
func (t *Track) SID() *specid.ID {
return &specid.ID{Type: specid.Track, Value: t.ID}
}
func (t *Track) AlbumSID() specid.ID {
return specid.ID{Type: specid.Album, Value: t.AlbumID}
func (t *Track) AlbumSID() *specid.ID {
return &specid.ID{Type: specid.Album, Value: t.AlbumID}
}
func (t *Track) ArtistSID() specid.ID {
return specid.ID{Type: specid.Artist, Value: t.ArtistID}
func (t *Track) ArtistSID() *specid.ID {
return &specid.ID{Type: specid.Artist, Value: t.ArtistID}
}
func (t *Track) Ext() string {
@@ -176,12 +176,12 @@ type Album struct {
ReceivedTags bool `gorm:"-"`
}
func (a *Album) SID() specid.ID {
return specid.ID{Type: specid.Album, Value: a.ID}
func (a *Album) SID() *specid.ID {
return &specid.ID{Type: specid.Album, Value: a.ID}
}
func (a *Album) ParentSID() specid.ID {
return specid.ID{Type: specid.Album, Value: a.ParentID}
func (a *Album) ParentSID() *specid.ID {
return &specid.ID{Type: specid.Album, Value: a.ParentID}
}
func (a *Album) IndexRightPath() string {