storage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImageTooLarge      = fmt.Errorf("too large image, must be not greater than %d bytes", maxImageSize)
	ErrIncorrectImageType = fmt.Errorf("incorrect object type, must be image/png or image/jpeg")
	ErrURLRegexp          = fmt.Errorf("url don't match regexp")
	ErrInvalidBucket      = fmt.Errorf("invalid bucket")
	ErrInvalidKey         = fmt.Errorf("invalid key")
	ErrRegionMismatched   = fmt.Errorf("aws datacenter region mismatched")
)

Functions

func IsBadRequestError

func IsBadRequestError(err error) bool

Types

type SpacesURL

type SpacesURL struct {
	URL    *url.URL
	Bucket string
	Key    string
	Region string
}

func ParseDOSpacesURL

func ParseDOSpacesURL(object *url.URL) (*SpacesURL, error)

type Storage

type Storage struct {
	APIKey string
	// contains filtered or unexported fields
}

func (*Storage) BucketAndKey

func (s *Storage) BucketAndKey(link *url.URL) (bucket, key string, err error)

func (*Storage) GenerateGetURL

func (s *Storage) GenerateGetURL(link *url.URL) (signedURL string, err error)

func (*Storage) GeneratePutURL

func (s *Storage) GeneratePutURL(fileName, contentType string, contentLength int64) (signedURL, key string, err error)

func (*Storage) GetURL

func (s *Storage) GetURL(key string) string

func (*Storage) RawSignedGetURL

func (s *Storage) RawSignedGetURL(key string) (signedURL string, err error)

func (*Storage) UploadB64Image

func (s *Storage) UploadB64Image(imageB64 *string) (key string, err error)

func (*Storage) ValidateImage

func (s *Storage) ValidateImage(object *url.URL, id string) error

type Storager

type Storager interface {
	Storage() *Storage
}

func NewStorager

func NewStorager(getter kv.Getter) Storager

Jump to

Keyboard shortcuts

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