repository

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

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) ClearHistory

func (r *Repository) ClearHistory() error

ClearHistory ...

func (*Repository) Close

func (r *Repository) Close() error

Close ...

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL