Documentation
¶
Index ¶
- func DisplayPostImage(ctx context.Context, out io.Writer, post *xkcd.Post, d Displayer) error
- func DisplayPostInfos(out io.Writer, post *xkcd.Post, jsonMode bool) error
- type Displayer
- type Execer
- type Index
- func (i *Index) Close() error
- func (i *Index) Get(ctx context.Context, client *xkcd.Client, num uint) (*xkcd.Post, error)
- func (i *Index) GetLastUpdate() (time.Time, uint, error)
- func (i *Index) Init(ctx context.Context, force, offline bool) error
- func (i *Index) Initized() bool
- func (i *Index) Update(ctx context.Context, client *xkcd.Client, start, end, workers uint) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayPostImage ¶
DisplayPost displays a post image.
Types ¶
type Displayer ¶
Displayer is a function that writes an image to an output writer.
func GetDisplayer ¶
GetDisplayer checks if the terminal supports one of image inline protocols and returns the corresponding displayer or nil if it cannot.
type Execer ¶
type Execer interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
Execer is an interface for the database's ExecContext method.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is an index instance.
func (*Index) Get ¶
Get gets a post. If it exists in index, it returns it. Else, it fetches it from xkcd API client and stores it in index.
func (*Index) GetLastUpdate ¶
GetLastUpdate retrieves the last update date and post number from the index.
Click to show internal directories.
Click to hide internal directories.