upload

package
v0.0.0-...-7344819 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package upload is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownDriver defines a named error for unknown upload drivers.
	ErrUnknownDriver = errors.New("unknown upload driver")
)

Functions

This section is empty.

Types

type FileUpload

type FileUpload struct {
	// contains filtered or unexported fields
}

FileUpload implements the Upload interface.

func (*FileUpload) Close

func (u *FileUpload) Close() error

Close simply closes the upload handler.

func (*FileUpload) Delete

func (u *FileUpload) Delete(path string) error

Delete removes an attachment from the defined S3 bucket.

func (*FileUpload) Handler

func (u *FileUpload) Handler(root string) http.Handler

Handler implements an HTTP handler for asset uploads.

func (*FileUpload) Info

func (u *FileUpload) Info() map[string]interface{}

Info prepares some informational message about the handler.

func (*FileUpload) Prepare

func (u *FileUpload) Prepare() (Upload, error)

Prepare simply prepares the upload handler.

func (*FileUpload) Upload

func (u *FileUpload) Upload(path, ctype string, content []byte) error

Upload stores an attachment within the defined S3 bucket.

type MockUpload

type MockUpload struct {
	// contains filtered or unexported fields
}

MockUpload is a mock of Upload interface.

func NewMockUpload

func NewMockUpload(ctrl *gomock.Controller) *MockUpload

NewMockUpload creates a new mock instance.

func (*MockUpload) Close

func (m *MockUpload) Close() error

Close mocks base method.

func (*MockUpload) Delete

func (m *MockUpload) Delete(arg0 string) error

Delete mocks base method.

func (*MockUpload) EXPECT

func (m *MockUpload) EXPECT() *MockUploadMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUpload) Handler

func (m *MockUpload) Handler(arg0 string) http.Handler

Handler mocks base method.

func (*MockUpload) Info

func (m *MockUpload) Info() map[string]interface{}

Info mocks base method.

func (*MockUpload) Prepare

func (m *MockUpload) Prepare() (Upload, error)

Prepare mocks base method.

func (*MockUpload) Upload

func (m *MockUpload) Upload(arg0, arg1 string, arg2 []byte) error

Upload mocks base method.

type MockUploadMockRecorder

type MockUploadMockRecorder struct {
	// contains filtered or unexported fields
}

MockUploadMockRecorder is the mock recorder for MockUpload.

func (*MockUploadMockRecorder) Close

func (mr *MockUploadMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockUploadMockRecorder) Delete

func (mr *MockUploadMockRecorder) Delete(arg0 interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockUploadMockRecorder) Handler

func (mr *MockUploadMockRecorder) Handler(arg0 interface{}) *gomock.Call

Handler indicates an expected call of Handler.

func (*MockUploadMockRecorder) Info

func (mr *MockUploadMockRecorder) Info() *gomock.Call

Info indicates an expected call of Info.

func (*MockUploadMockRecorder) Prepare

func (mr *MockUploadMockRecorder) Prepare() *gomock.Call

Prepare indicates an expected call of Prepare.

func (*MockUploadMockRecorder) Upload

func (mr *MockUploadMockRecorder) Upload(arg0, arg1, arg2 interface{}) *gomock.Call

Upload indicates an expected call of Upload.

type S3Upload

type S3Upload struct {
	// contains filtered or unexported fields
}

S3Upload implements the Upload interface.

func (*S3Upload) Close

func (u *S3Upload) Close() error

Close simply closes the upload handler.

func (*S3Upload) Delete

func (u *S3Upload) Delete(path string) error

Delete removes an attachment from the defined S3 bucket.

func (*S3Upload) Handler

func (u *S3Upload) Handler(root string) http.Handler

Handler implements an HTTP handler for asset uploads.

func (*S3Upload) Info

func (u *S3Upload) Info() map[string]interface{}

Info prepares some informational message about the handler.

func (*S3Upload) Prepare

func (u *S3Upload) Prepare() (Upload, error)

Prepare simply prepares the upload handler.

func (*S3Upload) Upload

func (u *S3Upload) Upload(path, ctype string, content []byte) error

Upload stores an attachment within the defined S3 bucket.

type Upload

type Upload interface {
	Info() map[string]interface{}
	Prepare() (Upload, error)
	Close() error
	Upload(string, string, []byte) error
	Delete(string) error
	Handler(string) http.Handler
}

Upload provides the interface for the upload implementations.

func MustFileUpload

func MustFileUpload(cfg config.Upload) Upload

MustFileUpload simply calls NewFileUpload and panics on an error.

func MustS3Upload

func MustS3Upload(cfg config.Upload) Upload

MustS3Upload simply calls NewS3Upload and panics on an error.

func NewFileUpload

func NewFileUpload(cfg config.Upload) (Upload, error)

NewFileUpload initializes a new file handler.

func NewS3Upload

func NewS3Upload(cfg config.Upload) (Upload, error)

NewS3Upload initializes a new S3 handler.

Jump to

Keyboard shortcuts

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