avatar

package
v0.0.0-...-8405ca7 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: MIT Imports: 20 Imported by: 2

Documentation

Overview

Package avatar provides a service that manages forum user avatars.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImageDecode   = errors.New("avatar: image decode failed")
	ErrImageTooSmall = errors.New("avatar: image too small")
	ErrImageTooLarge = errors.New("avatar: image too large")
)

Input image format/size errors.

Functions

This section is empty.

Types

type MockService

type MockService struct {
	OnSave     func(user *store.User, imageData []byte) error
	OnGenerate func(user *store.User) error
	OnURL      func(user *store.User) string
}

MockService is a mock implementation of avatar.Service

func (*MockService) Generate

func (s *MockService) Generate(user *store.User) error

func (*MockService) Save

func (s *MockService) Save(user *store.User, imageData []byte) error

func (*MockService) URL

func (s *MockService) URL(user *store.User) string

type Service

type Service interface {
	// Save preprocesses and saves a new avatar for the given user.
	Save(user *store.User, imageData []byte) error

	// Generate generates a new avatar for the given user.
	Generate(user *store.User) error

	// URL returns the avatar URL of the given user.
	URL(user *store.User) string
}

Service is an avatar-processing service.

func NewService

func NewService(userStore store.UserStore, fileStorage filestorage.FileStorage, logger *log.Logger) Service

NewService creates a new avatar service.

Jump to

Keyboard shortcuts

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