Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct {
ID int
Title string
Authors []string
Pages int
Slug string
ImageURL string
Rating float64
RatingsCount int
ReviewsCount int
UsersCount int
UsersReadCount int
ReleaseDate string
FeaturedSeries string
FeaturedSeriesPosition int
}
Book represents a book from Hardcover.
func (Book) AuthorString ¶
AuthorString returns authors joined by ", ".
type DayActivity ¶
DayActivity represents total reading minutes for a single day.
type PageUpdate ¶
type PageUpdate struct {
Absolute int // target page (if not relative)
Delta int // delta (if relative)
Relative bool // true if +N or -N
}
PageUpdate represents a parsed page update instruction.
func ParsePage ¶
func ParsePage(s string) (PageUpdate, error)
ParsePage parses a page string: "123", "+10", "-5".
func (PageUpdate) Resolve ¶
func (p PageUpdate) Resolve(currentPage, totalPages int) int
Resolve computes the final page number given the current page and total.
type ReadingSession ¶
type ReadingSession struct {
ID int
BookID int // 0 = no book associated
StartedAt time.Time
EndedAt *time.Time // nil = still running (should not be stored without end)
Notes string
BookTitle string // denormalized for display
}
ReadingSession represents a timed reading session stored locally.
func (ReadingSession) Duration ¶
func (s ReadingSession) Duration() time.Duration
Duration returns the session duration. Returns zero if EndedAt is nil.
type SearchMode ¶
type SearchMode string
SearchMode represents a discovery intent in search.
const ( SearchModeBook SearchMode = "book" SearchModeAuthor SearchMode = "author" SearchModeGenre SearchMode = "genre" )
func ParseSearchMode ¶
func ParseSearchMode(raw string) (SearchMode, error)
ParseSearchMode parses a user-facing search mode value.
func (SearchMode) Description ¶
func (m SearchMode) Description() string
Description returns the applied discovery strategy.
func (SearchMode) Label ¶
func (m SearchMode) Label() string
Label returns a compact uppercase label suitable for badges.
func (SearchMode) Next ¶
func (m SearchMode) Next() SearchMode
Next cycles through modes in a deterministic order.
type SearchResult ¶
type SearchResult struct {
ID int
Title string
Authors []string
Pages int
Slug string
ImageURL string
Rating float64
Ratings int
}
SearchResult represents a book from the search API.
type Status ¶
type Status int
Status represents a user-book status on Hardcover.
func StatusFromString ¶
StatusFromString maps CLI aliases to status IDs.
type StreakInfo ¶
type StreakInfo struct {
Current int // consecutive days ending today or yesterday
Longest int // longest streak ever
Total int // total days with at least one session
ReadToday bool // whether there's a completed session today
}
StreakInfo holds computed streak statistics.
type TimerState ¶
TimerState represents the currently running timer, stored as JSON in the state KV table.
type UserBook ¶
type UserBook struct {
ID int
BookID int
StatusID Status
CurrentPage int
Book Book
UserBookReads []UserBookRead
UpdatedAt time.Time
}
UserBook represents the user's relationship with a book.