1package model 2 3import "time" 4 5type Artist struct { 6 Annotations 7 8 ID string `json:"id" orm:"column(id)"` 9 Name string `json:"name"` 10 AlbumCount int `json:"albumCount"` 11 SongCount int `json:"songCount"` 12 FullText string `json:"fullText"` 13 SortArtistName string `json:"sortArtistName"` 14 OrderArtistName string `json:"orderArtistName"` 15 Size int64 `json:"size"` 16 MbzArtistID string `json:"mbzArtistId" orm:"column(mbz_artist_id)"` 17 Biography string `json:"biography"` 18 SmallImageUrl string `json:"smallImageUrl"` 19 MediumImageUrl string `json:"mediumImageUrl"` 20 LargeImageUrl string `json:"largeImageUrl"` 21 ExternalUrl string `json:"externalUrl" orm:"column(external_url)"` 22 SimilarArtists Artists `json:"-" orm:"-"` 23 ExternalInfoUpdatedAt time.Time `json:"externalInfoUpdatedAt"` 24} 25 26func (a Artist) ArtistImageUrl() string { 27 if a.MediumImageUrl != "" { 28 return a.MediumImageUrl 29 } 30 if a.LargeImageUrl != "" { 31 return a.LargeImageUrl 32 } 33 return a.SmallImageUrl 34} 35 36type Artists []Artist 37 38type ArtistIndex struct { 39 ID string 40 Artists Artists 41} 42type ArtistIndexes []ArtistIndex 43 44type ArtistRepository interface { 45 CountAll(options ...QueryOptions) (int64, error) 46 Exists(id string) (bool, error) 47 Put(m *Artist) error 48 Get(id string) (*Artist, error) 49 GetAll(options ...QueryOptions) (Artists, error) 50 GetStarred(options ...QueryOptions) (Artists, error) 51 Search(q string, offset int, size int) (Artists, error) 52 Refresh(ids ...string) error 53 GetIndex() (ArtistIndexes, error) 54 AnnotatedRepository 55} 56 57func (a Artist) GetAnnotations() Annotations { 58 return a.Annotations 59} 60