usecases

package
v0.0.0-...-f18c969 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package usecases is the bridge between the domain and the interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashDecoder

type HashDecoder interface {
	Decode(string) (ImageDescription, error)
}

HashDecoder decodes a hash to an ImageDescription

type ImageDescription

type ImageDescription struct {
	Path   string
	Width  int
	Height int
}

ImageDescription describes an image extracted from the hash

type ImageFetcher

type ImageFetcher interface {
	Fetch(path string) (image.Image, error)
}

ImageFetcher fetches an image from the given url.URL

type ImageResizer

type ImageResizer interface {
	Resize(image image.Image, w, h int) (image.Image, error)
}

ImageResizer resizes an image based on w and h

type Logger

type Logger interface {
	Log(format string, args ...interface{})
}

Logger abstracts away the loggin

type ThumbnailInteractor

type ThumbnailInteractor struct {
	ThumbnailRepository domain.ThumbnailRepository
	ImageResizer        ImageResizer
	ImageFetcher        ImageFetcher
	HashDecoder         HashDecoder
	Logger              Logger
}

ThumbnailInteractor contains all players involved in creating thumbnails

func (*ThumbnailInteractor) Add

func (ti *ThumbnailInteractor) Add(hash string) (image.Image, error)

Add adds a new thumbnail based on the hash to the thumbnail repository

func (*ThumbnailInteractor) Get

func (ti *ThumbnailInteractor) Get(hash string) (image.Image, error)

Get returns an thumbnail image generated from the given hash, error otherwise

Jump to

Keyboard shortcuts

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