Use AnimeID type

This commit is contained in:
2019-06-07 10:50:38 +09:00
parent a3f04fbd2f
commit 18a7be18d2
12 changed files with 41 additions and 35 deletions

@ -9,7 +9,7 @@ import (
// AnimeRelations is a list of relations for an anime.
type AnimeRelations struct {
AnimeID string `json:"animeId" mainID:"true"`
AnimeID AnimeID `json:"animeId" mainID:"true"`
Items []*AnimeRelation `json:"items" editable:"true"`
sync.Mutex
@ -72,7 +72,7 @@ func (relations *AnimeRelations) Self() Loggable {
}
// Find returns the relation with the specified anime ID, if available.
func (relations *AnimeRelations) Find(animeID string) *AnimeRelation {
func (relations *AnimeRelations) Find(animeID AnimeID) *AnimeRelation {
relations.Lock()
defer relations.Unlock()
@ -86,7 +86,7 @@ func (relations *AnimeRelations) Find(animeID string) *AnimeRelation {
}
// Remove removes the anime ID from the relations.
func (relations *AnimeRelations) Remove(animeID string) bool {
func (relations *AnimeRelations) Remove(animeID AnimeID) bool {
relations.Lock()
defer relations.Unlock()
@ -101,7 +101,7 @@ func (relations *AnimeRelations) Remove(animeID string) bool {
}
// GetAnimeRelations ...
func GetAnimeRelations(animeID string) (*AnimeRelations, error) {
func GetAnimeRelations(animeID AnimeID) (*AnimeRelations, error) {
obj, err := DB.Get("AnimeRelations", animeID)
if err != nil {