s3storage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(h *S3Storage)

Option S3Storage option

func WithBaseDir

func WithBaseDir(baseDir string) Option

WithBaseDir with base dir option

func WithExpiration

func WithExpiration(exp time.Duration) Option

WithExpiration with modified time expiration option

func WithPathPrefix

func WithPathPrefix(prefix string) Option

WithPathPrefix with path prefix option

func WithSafeChars

func WithSafeChars(chars string) Option

WithSafeChars with safe chars option

type S3Storage

type S3Storage struct {
	S3         *s3.S3
	Uploader   *s3manager.Uploader
	Downloader *s3manager.Downloader
	Bucket     string

	BaseDir    string
	PathPrefix string
	ACL        string
	SafeChars  string
	Expiration time.Duration
	// contains filtered or unexported fields
}

S3Storage AWS S3 Storage implements imagor.Storage interface

func New

func New(sess *session.Session, bucket string, options ...Option) *S3Storage

New creates S3Storage

func (*S3Storage) Delete

func (s *S3Storage) Delete(ctx context.Context, image string) error

Delete implements imagor.Storage interface

func (*S3Storage) Get

func (s *S3Storage) Get(r *http.Request, image string) (*imagor.Blob, error)

Get implements imagor.Storage interface

func (*S3Storage) Path

func (s *S3Storage) Path(image string) (string, bool)

Path transforms and validates image key for storage path

func (*S3Storage) Put

func (s *S3Storage) Put(ctx context.Context, image string, blob *imagor.Blob) error

Put implements imagor.Storage interface

func (*S3Storage) Stat

func (s *S3Storage) Stat(ctx context.Context, image string) (stat *imagor.Stat, err error)

Stat implements imagor.Storage interface

Jump to

Keyboard shortcuts

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