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
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.
Click to show internal directories.
Click to hide internal directories.