Documentation ¶
Index ¶
- Variables
- type Cache
- type Config
- type FileSystemCache
- func (fs *FileSystemCache) Delete(bucket, filename string, params *Params) error
- func (fs *FileSystemCache) Flush(bucket string) error
- func (fs *FileSystemCache) Load(bucket, filename string, params *Params) (*bytes.Buffer, error)
- func (fs *FileSystemCache) Save(bucket, filename string, params *Params, data []byte) error
- type FileSystemSource
- type GMProcessor
- type Ivy
- type Params
- type Processor
- type S3Source
- type Source
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is error not found
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Save(bucket, filename string, params *Params, file []byte) error Load(bucket, filename string, params *Params) (*bytes.Buffer, error) Delete(bucket, filename string, params *Params) error Flush(bucket string) error }
Cache interface
type Config ¶
type Config struct { HTTPCache int64 //Enable http cache in second IsDevelopment bool //Enable dev mode, all cache will be disabled }
Config config for ivy
type FileSystemCache ¶
type FileSystemCache struct {
// contains filtered or unexported fields
}
FileSystemCache is file system cache
func NewFileSystemCache ¶
func NewFileSystemCache(root string) *FileSystemCache
NewFileSystemCache create file system cache
func (*FileSystemCache) Delete ¶
func (fs *FileSystemCache) Delete(bucket, filename string, params *Params) error
Delete delete individual ache file
func (*FileSystemCache) Flush ¶
func (fs *FileSystemCache) Flush(bucket string) error
Flush remove all cache file specific bucket
type FileSystemSource ¶
type FileSystemSource struct {
// contains filtered or unexported fields
}
FileSystemSource is file system source
func NewFileSystemSource ¶
func NewFileSystemSource(root string) *FileSystemSource
NewFileSystemSource create new file source
func (*FileSystemSource) GetFilePath ¶
func (fs *FileSystemSource) GetFilePath(bucket, filename string) string
GetFilePath get file path
type GMProcessor ¶
type GMProcessor struct{}
GMProcessor is GraphicsMagick processor
func NewGMProcessor ¶
func NewGMProcessor() *GMProcessor
NewGMProcessor create GraphicsMagick processor
type Ivy ¶
Ivy main struct of this package
func New ¶
New ivy with config source is the assets location cache is the location where cache will be store, or set nil if disable cache
func (*Ivy) DeleteCache ¶
DeleteCache remove individual cache file
func (*Ivy) FlushCache ¶
FlushCache remove all cache file in specific bucket
func (*Ivy) Get ¶
Get get file or image if content type is image type and param not nil, process and return image if content type is image type and param nil, return raw image if content type is not image type, return raw file if cache enable, image type will cache. Next time return cache file if cache disable image type will not cahce, process and return image every time if HTTPCache is enable in config, return 304 status on next time
type Params ¶
type Params struct { Width int Height int CropWidth int CropHeight int Gravity string Quality int EnableCrop bool EnableResize bool EnableGravity bool IsDefault bool // contains filtered or unexported fields }
Params for set up image
func ParseParams ¶
ParseParams parse params string into params struct
type Processor ¶
type Processor interface {
Process(params *Params, filePath string, file *bytes.Buffer) (*bytes.Buffer, error)
}
Processor interface for process image
type S3Source ¶
type S3Source struct {
// contains filtered or unexported fields
}
S3Source is aws s3 asset source
func NewS3Source ¶
NewS3Source create s3 source with access key and secret key
func (*S3Source) GetFilePath ¶
GetFilePath return filepath