storage

package
v0.0.0-...-a4d1c61 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingFile is returned when Upload gets called and no file is provided.
	ErrMissingFile = errors.New("missing file")
	// ErrBadContentType is returned when Upload gets called with an ivnalid content type.
	ErrBadContentType = errors.New("bad content type")
)

Functions

This section is empty.

Types

type Storage

type Storage interface {
	// Upload uploads a file to a cloud storage.
	Upload(input UploadInput) error
	// GetURL returns the URL of the given bucket and key from a cloud storage.
	GetURL(bucket string, key string, expiresIn time.Duration) (string, error)
	// PrepareAddress returns the address for the given bucket with the given key.
	PrepareAddress(bucket, key string) string
}

Storage groups a set of methods to interact with a Cloud Storage.

type UploadInput

type UploadInput struct {
	Bucket        string
	Key           string
	File          *bytes.Reader
	ContentLength int64
	ContentType   string
}

UploadInput is the input for the Storage.Upload operation. It will be used to upload a file to a certain bucket.

Directories

Path Synopsis
s3

Jump to

Keyboard shortcuts

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