image

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImageZeroSize = errors.New("image has 0px dimension")

Functions

func GetImagePath

func GetImagePath(imageDir string, checksum string) string

func GetSiteIcon added in v0.1.0

func GetSiteIcon(ctx context.Context, site models.Site) ([]byte, error)

Types

type Backend added in v0.1.0

type Backend interface {
	WriteFile(file *bytes.Reader, image *models.Image) error
	DestroyFile(image *models.Image) error
}

type BackendService added in v0.1.0

type BackendService interface {
	Create(input models.ImageCreateInput) (*models.Image, error)
	Destroy(input models.ImageDestroyInput) error
	DestroyUnusedImages() error
	DestroyUnusedImage(imageID uuid.UUID) error
}

func GetService

func GetService(repo models.ImageRepo) BackendService

type FileBackend

type FileBackend struct{}

func (*FileBackend) DestroyFile

func (s *FileBackend) DestroyFile(image *models.Image) error

func (*FileBackend) WriteFile

func (s *FileBackend) WriteFile(file *bytes.Reader, image *models.Image) error

type S3Backend

type S3Backend struct{}

func (*S3Backend) DestroyFile

func (s *S3Backend) DestroyFile(image *models.Image) error

func (*S3Backend) WriteFile

func (s *S3Backend) WriteFile(file *bytes.Reader, image *models.Image) error

type Service

type Service struct {
	Repository models.ImageRepo
	Backend    Backend
}

func (*Service) Create

func (s *Service) Create(input models.ImageCreateInput) (*models.Image, error)

func (*Service) Destroy

func (s *Service) Destroy(input models.ImageDestroyInput) error

func (*Service) DestroyUnusedImage

func (s *Service) DestroyUnusedImage(imageID uuid.UUID) error

DestroyUnusedImage destroys the image with the provided ID if it is not used for a scene, performer or studio.

func (*Service) DestroyUnusedImages

func (s *Service) DestroyUnusedImages() error

DestroyUnusedImages destroys all images that are not used for a scene, performer or studio.

Jump to

Keyboard shortcuts

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