Documentation ¶
Index ¶
- type Repository
- func (r *Repository) AddWallpaper(wallpaper *Wallpaper) (int64, error)
- func (r *Repository) ClearHistory() error
- func (r *Repository) Close() error
- func (r *Repository) GetWallpaper(id int) (*Wallpaper, error)
- func (r *Repository) GetWallpapers() ([]*Wallpaper, error)
- func (r *Repository) IsOriginURLAlreadyPresented(originUrl string) (bool, error)
- type Wallpaper
- type Wallpapers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository allows other program modules to make operations with local SQLite database. Now it's used for storing history only.
func Open ¶
func Open(dbPath string) (*Repository, error)
Open tries to open SQLite connection. Returns Repository instance on success or error on failure.
func (*Repository) AddWallpaper ¶
func (r *Repository) AddWallpaper(wallpaper *Wallpaper) (int64, error)
AddWallpaper ...
func (*Repository) GetWallpaper ¶
func (r *Repository) GetWallpaper(id int) (*Wallpaper, error)
GetWallpaper ...
func (*Repository) GetWallpapers ¶
func (r *Repository) GetWallpapers() ([]*Wallpaper, error)
GetWallpapers ...
func (*Repository) IsOriginURLAlreadyPresented ¶
func (r *Repository) IsOriginURLAlreadyPresented(originUrl string) (bool, error)
IsOriginURLAlreadyPresented is legacy method used in past for checking if wallpaper has already downloaded earlier. Now I consider removing this.
type Wallpaper ¶
type Wallpaper struct { ID int64 // OriginURL is URL of web page where wallpaper has been taken. OriginURL string // Filename is name of the file in local image repository. Filename string // FetchTimestamp is a time when wallpaper has been fetched and downloaded. FetchTimestamp uint // Title is original title of wallpaper on source website. Title string // Author is full name or nickname of image publisher (optional). Author string // AuthorURL is author's homepage address (optional). AuthorURL string // ImgBuffer contains image bytes taken from provider. ImgBuffer []byte }
type Wallpapers ¶
type Wallpapers []*Wallpaper
func (Wallpapers) Len ¶
func (w Wallpapers) Len() int
func (Wallpapers) Less ¶
func (w Wallpapers) Less(i, j int) bool
func (Wallpapers) Swap ¶
func (w Wallpapers) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.