use aliases for ID types

This commit is contained in:
milarin 2023-03-03 14:50:27 +01:00
parent f697e9268f
commit 819221d01d
2 changed files with 6 additions and 6 deletions

4
api.go
View File

@ -181,8 +181,8 @@ func (api *Api) getChapterEntriesByPageIndex(ctx context.Context, novelID NovelI
entryElems.Each(func(i int, s *goquery.Selection) { entryElems.Each(func(i int, s *goquery.Selection) {
td3 := s.Find("td:nth-child(3) a.chp-release") td3 := s.Find("td:nth-child(3) a.chp-release")
chapterID := ChapterID(td3.Text()) chapterID := td3.Text()
groupID := GroupID(path.Base(s.Find("td:nth-child(2) a").AttrOr("href", ""))) groupID := path.Base(s.Find("td:nth-child(2) a").AttrOr("href", ""))
link := "https:" + td3.AttrOr("href", "") link := "https:" + td3.AttrOr("href", "")
date, err := time.Parse("01/02/06", strings.TrimSpace(s.Find("td:first-child").Text())) date, err := time.Parse("01/02/06", strings.TrimSpace(s.Find("td:first-child").Text()))

View File

@ -5,10 +5,10 @@ import (
"time" "time"
) )
type NovelID string type NovelID = string
type ChapterID string type ChapterID = string
type ReadingListID string type ReadingListID = string
type GroupID string type GroupID = string
type ReadingList struct { type ReadingList struct {
ID ReadingListID `json:"id"` ID ReadingListID `json:"id"`