Documentation
¶
Index ¶
- Constants
- Variables
- func EnsureIdMap(medias []AniListMedia, listId string) error
- func IsValidSearchList(name string) bool
- func ScheduleIdMapSync(medias []AniListMedia)
- func UpsertList(list *AniListList) (err error)
- type AniListList
- type AniListListMedia
- type AniListMedia
- type AniListMediaGenre
- type Genre
- type List
- type ListColumnStruct
- type ListMedia
- type ListMediaColumnStruct
- type Media
- type MediaColumnStruct
- type MediaFormat
- type MediaFormatInfo
- type MediaGenreColumnStruct
- type MediaSeason
- type MediaSort
- type SearchAnimeListData
Constants ¶
View Source
const ListMediaTableName = "anilist_list_media"
View Source
const ListTableName = "anilist_list"
View Source
const MediaGenreTableName = "anilist_media_genre"
View Source
const MediaTableName = "anilist_media"
Variables ¶
View Source
var Genres = []Genre{ GenreAction, GenreAdventure, GenreComedy, GenreDrama, GenreEcchi, GenreFantasy, GenreHentai, GenreHorror, GenreMahouShoujo, GenreMecha, GenreMusic, GenreMystery, GenrePsychological, GenreRomance, GenreSciFi, GenreSliceOfLife, GenreSports, GenreSupernatural, }
View Source
var ListColumn = ListColumnStruct{
Id: "id",
UpdatedAt: "uat",
}
View Source
var ListColumns = []string{ ListColumn.Id, ListColumn.UpdatedAt, }
View Source
var ListMediaColumn = ListMediaColumnStruct{
MediaId: "media_id",
ListId: "list_id",
Score: "score",
}
View Source
var ListMediaColumns = []string{ ListMediaColumn.ListId, ListMediaColumn.MediaId, ListMediaColumn.Score, }
View Source
var MediaColumn = MediaColumnStruct{
Id: "id",
Type: "type",
Title: "title",
Description: "description",
Banner: "banner",
Cover: "cover",
Duration: "duration",
IsAdult: "is_adult",
StartYear: "start_year",
UpdatedAt: "uat",
}
View Source
var MediaColumns = []string{ MediaColumn.Id, MediaColumn.Type, MediaColumn.Title, MediaColumn.Description, MediaColumn.Banner, MediaColumn.Cover, MediaColumn.Duration, MediaColumn.IsAdult, MediaColumn.StartYear, MediaColumn.UpdatedAt, }
View Source
var MediaGenreColumn = MediaGenreColumnStruct{
MediaId: "media_id",
Genre: "genre",
}
Functions ¶
func EnsureIdMap ¶
func EnsureIdMap(medias []AniListMedia, listId string) error
func IsValidSearchList ¶
func ScheduleIdMapSync ¶
func ScheduleIdMapSync(medias []AniListMedia)
func UpsertList ¶
func UpsertList(list *AniListList) (err error)
Types ¶
type AniListList ¶
type AniListList struct {
Id string `json:"id"`
UpdatedAt db.Timestamp `json:"uat"`
Medias []AniListMedia `json:"-"`
}
func GetListById ¶
func GetListById(id string) (*AniListList, error)
func (*AniListList) Fetch ¶
func (l *AniListList) Fetch() error
func (*AniListList) GetDisplayName ¶
func (l *AniListList) GetDisplayName() string
func (*AniListList) GetName ¶
func (l *AniListList) GetName() string
func (*AniListList) GetURL ¶
func (l *AniListList) GetURL() string
func (*AniListList) GetUserName ¶
func (l *AniListList) GetUserName() string
func (*AniListList) IsStale ¶
func (l *AniListList) IsStale() bool
type AniListListMedia ¶
type AniListMedia ¶
type AniListMedia struct {
Id int `json:"id"`
Type MediaFormat `json:"type"`
Title string `json:"title"`
Description string `json:"description"`
Banner string `json:"banner"`
Cover string `json:"cover"`
Duration int `json:"duration"`
IsAdult bool `json:"is_adult"`
StartYear int `json:"start_year"`
UpdatedAt db.Timestamp `json:"uat"`
Genres genreList `json:"-"`
Score int `json:"-"`
IdMap *anime.AnimeIdMap `json:"-"`
}
func (*AniListMedia) IsStale ¶
func (m *AniListMedia) IsStale() bool
type AniListMediaGenre ¶
type Genre ¶
type Genre = string
const ( GenreAction Genre = "Action" GenreAdventure Genre = "Adventure" GenreComedy Genre = "Comedy" GenreDrama Genre = "Drama" GenreEcchi Genre = "Ecchi" GenreFantasy Genre = "Fantasy" GenreHentai Genre = "Hentai" GenreHorror Genre = "Horror" GenreMahouShoujo Genre = "Mahou Shoujo" GenreMecha Genre = "Mecha" GenreMusic Genre = "Music" GenreMystery Genre = "Mystery" GenrePsychological Genre = "Psychological" GenreRomance Genre = "Romance" GenreSciFi Genre = "Sci-Fi" GenreSliceOfLife Genre = "Slice of Life" GenreSports Genre = "Sports" GenreSupernatural Genre = "Supernatural" )
type List ¶
type List struct {
UserName string
Name string
IsCustom bool
MediaIds []int
ScoreByMediaId map[int]int
}
func FetchSearchList ¶
func FetchUserList ¶
type ListColumnStruct ¶
type ListMediaColumnStruct ¶
type Media ¶
type Media struct {
Id int
IdMal int
Format MediaFormat
Title string
Description string
BannerImage string
CoverImage string
Duration int
IsAdult bool
Genres []string
StartYear int
}
func FetchMedias ¶
type MediaColumnStruct ¶
type MediaFormat ¶
type MediaFormat string
const ( MediaFormatTV MediaFormat = "TV" MediaFormatTVShort MediaFormat = "TV_SHORT" MediaFormatMovie MediaFormat = "MOVIE" MediaFormatSpecial MediaFormat = "SPECIAL" MediaFormatOVA MediaFormat = "OVA" MediaFormatONA MediaFormat = "ONA" MediaFormatMusic MediaFormat = "MUSIC" MediaFormatManga MediaFormat = "MANGA" MediaFormatNovel MediaFormat = "NOVEL" MediaFormatOneShot MediaFormat = "ONE_SHOT" )
func (MediaFormat) ToSimple ¶
func (mf MediaFormat) ToSimple() string
type MediaFormatInfo ¶
type MediaFormatInfo struct {
Id int
IdMal int
Format MediaFormat
}
func FetchAnimeMediaFormatInfo ¶
func FetchAnimeMediaFormatInfo(mediaIds []int) ([]MediaFormatInfo, error)
type MediaGenreColumnStruct ¶
type MediaSeason ¶
type MediaSeason string
const ( MediaSeasonWinter MediaSeason = "WINTER" MediaSeasonSpring MediaSeason = "SPRING" MediaSeasonSummer MediaSeason = "SUMMER" MediaSeasonFall MediaSeason = "FALL" )
type SearchAnimeListData ¶
type SearchAnimeListData struct {
Page struct {
Media []struct {
Id int `json:"id"`
} `json:"media"`
} `json:"Page"`
}
Click to show internal directories.
Click to hide internal directories.