preview

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package preview implements business logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Preview

type Preview struct {
	Previewer       preview.Previewer
	ImageURLEncoder encode.Hasher
	Cacher          cache.Cacher
	Storager        storage.Storager
}

Preview is the main Preview struct.

func NewPreview

func NewPreview(prevImpl preview.Previewer, encImpl encode.Hasher, cacheImpl cache.Cacher, storImpl storage.Storager,
) (*Preview, error)

NewPreview inits main Preview fields.

func (Preview) AddItemIntoCache

func (p Preview) AddItemIntoCache(item entities.CacheItem) (bool, error)

AddItemIntoCache adds image into cache.

func (Preview) CalcHash added in v0.3.0

func (p Preview) CalcHash(url string) (string, error)

CalcHash calculates hash for url.

func (Preview) Close

func (p Preview) Close() error

Close closes any open handlers.

func (Preview) IsItemInCache

func (p Preview) IsItemInCache(hash string) (entities.CacheItem, bool, error)

IsItemInCache returns image if it in the cache.

func (Preview) Preview

func (p Preview) Preview(width, height int, img image.Image, opts entities.ResizeOptions) image.Image

Preview returns preview result image.

Jump to

Keyboard shortcuts

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