quintodrome/domain/index.go

33 lines
686 B
Go
Raw Normal View History

2016-03-02 05:07:24 -09:00
package domain
2017-04-01 05:47:14 -08:00
import "github.com/cloudsonic/sonic-server/utils"
2016-03-03 17:42:12 -09:00
2016-03-02 05:07:24 -09:00
type ArtistInfo struct {
2016-03-27 16:13:00 -08:00
ArtistId string
Artist string
AlbumCount int
2016-03-02 05:07:24 -09:00
}
type ArtistIndex struct {
2016-03-02 09:18:39 -09:00
Id string
2016-03-03 17:42:12 -09:00
Artists ArtistInfos
}
type ArtistInfos []ArtistInfo
func (a ArtistInfos) Len() int { return len(a) }
2016-03-03 17:42:12 -09:00
func (a ArtistInfos) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ArtistInfos) Less(i, j int) bool {
return utils.NoArticle(a[i].Artist) < utils.NoArticle(a[j].Artist)
2016-03-02 05:07:24 -09:00
}
2016-03-03 17:01:55 -09:00
type ArtistIndexes []ArtistIndex
2016-03-02 05:07:24 -09:00
type ArtistIndexRepository interface {
BaseRepository
2016-03-02 05:07:24 -09:00
Put(m *ArtistIndex) error
Get(id string) (*ArtistIndex, error)
GetAll() (ArtistIndexes, error)
2016-03-26 18:29:26 -08:00
DeleteAll() error
2016-03-02 05:07:24 -09:00
}