diff options
author | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-02-23 21:37:34 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-02-23 21:37:34 +0530 |
commit | 9aeafb3e899ca96a7514d9756728afebcb907d55 (patch) | |
tree | 2054022bee2183b91d610c1149ec4722cd3aec8a /anime/ranking.structs.go | |
parent | 90a9cdb89025930fb7f455b423593a0a35799c4a (diff) |
made accessing anime ranking more convinient by directly adding RankNum to the rAnime datatype
Diffstat (limited to 'anime/ranking.structs.go')
-rw-r--r-- | anime/ranking.structs.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/anime/ranking.structs.go b/anime/ranking.structs.go index 03a4589..b0d357f 100644 --- a/anime/ranking.structs.go +++ b/anime/ranking.structs.go @@ -16,10 +16,16 @@ package anime +// Anime but with an extra RankNum field +type rAnime struct { + Anime + RankNum int +} + // this is how the API returns data (looks horrible) type RawRanking struct { Data []struct { - Anime Anime `json:"node"` + Anime rAnime `json:"node"` Ranking struct { Rank int `json:"rank"` } `json:"ranking"` @@ -28,14 +34,8 @@ type RawRanking struct { Paging ListPaging `json:"paging"` } -// each anime has a ranking number -type AnimeRankingTitle struct { - Anime Anime - RankNum int -} - // this is how mal2go returns data type AnimeRanking struct { - Titles []AnimeRankingTitle + Animes []rAnime Paging ListPaging } |