Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidMaxWidth is returned when max_width is not a positive integer. ErrInvalidMaxWidth = errors.New("max_width must be an integer greater than 0") // ErrInvalidSuffix is returned when suffix is empty or does not start with '_'. ErrInvalidSuffix = errors.New("suffix must be non-empty and start with '_'") // ErrDuplicateSuffix is returned when suffix is duplicated across config entries. ErrDuplicateSuffix = errors.New("suffix must be unique across all thumbnail entries") // ErrSuffixNotFound is returned when no thumbnail config matches the given suffix. ErrSuffixNotFound = errors.New("thumbnail config not found for suffix") )
Functions ¶
func ValidateUnique ¶
func ValidateUnique(configs []ThumbnailConfig) error
ValidateUnique checks configs for duplicate suffixes.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service caches thumbnail configurations and provides thread-safe access.
func NewService ¶
func NewService() *Service
NewService creates a Service pre-loaded with default thumbnail config.
func (*Service) GetAll ¶
func (s *Service) GetAll() []ThumbnailConfig
GetAll returns all cached thumbnail configs.
func (*Service) GetBySuffix ¶
func (s *Service) GetBySuffix(suffix string) (ThumbnailConfig, error)
GetBySuffix returns the thumbnail config matching the given suffix.
func (*Service) LoadConfigFromFile ¶
LoadConfigFromFile reads a TOML file and loads thumbnail configs into the service. If the file does not exist, defaults (already cached) are kept and no error is returned.
type ThumbnailConfig ¶
ThumbnailConfig represents a single thumbnail size configuration.
func (ThumbnailConfig) Validate ¶
func (tc ThumbnailConfig) Validate() error
Validate checks the ThumbnailConfig fields.
Click to show internal directories.
Click to hide internal directories.