diskstorage

package module
v0.0.0-...-51e4ec8 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package diskstorage is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskStorage

type DiskStorage interface {
	// GetBuffer returns the buffer value.
	GetBuffer() *bytes.Buffer
	// WriteFile saves the buffer with given path and permission to disk.
	WriteFile(filePath string, perm os.FileMode) error
	// Write saves the given byte slice to the buffer.
	Write(chunk []byte) error
	// Download downloads file by given target URL and save to file path.
	Download(ctx context.Context, targetURL, filePath string) error
	// Delete removes the file at the given file path.
	Delete(filePath string) error
	// ResetBuffer the buffer value.
	ResetBuffer()
}

DiskStorage defines the methods needed to store and manage files on disk.

func New

func New(opts ...Option) (DiskStorage, error)

New returns a new DiskStorage instance with an empty internal buffer.

type GoMockDiskStorage

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

GoMockDiskStorage is a mock of DiskStorage interface.

func NewGoMockDiskStorage

func NewGoMockDiskStorage(ctrl *gomock.Controller) *GoMockDiskStorage

NewGoMockDiskStorage creates a new mock instance.

func (*GoMockDiskStorage) Delete

func (m *GoMockDiskStorage) Delete(filePath string) error

Delete mocks base method.

func (*GoMockDiskStorage) Download

func (m *GoMockDiskStorage) Download(ctx context.Context, targetURL, filePath string) error

Download mocks base method.

func (*GoMockDiskStorage) EXPECT

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

func (*GoMockDiskStorage) GetBuffer

func (m *GoMockDiskStorage) GetBuffer() *bytes.Buffer

GetBuffer mocks base method.

func (*GoMockDiskStorage) ResetBuffer

func (m *GoMockDiskStorage) ResetBuffer()

ResetBuffer mocks base method.

func (*GoMockDiskStorage) Write

func (m *GoMockDiskStorage) Write(chunk []byte) error

Write mocks base method.

func (*GoMockDiskStorage) WriteFile

func (m *GoMockDiskStorage) WriteFile(filePath string, perm os.FileMode) error

WriteFile mocks base method.

type GoMockDiskStorageMockRecorder

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

GoMockDiskStorageMockRecorder is the mock recorder for GoMockDiskStorage.

func (*GoMockDiskStorageMockRecorder) Delete

func (mr *GoMockDiskStorageMockRecorder) Delete(filePath interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*GoMockDiskStorageMockRecorder) Download

func (mr *GoMockDiskStorageMockRecorder) Download(ctx, targetURL, filePath interface{}) *gomock.Call

Download indicates an expected call of Download.

func (*GoMockDiskStorageMockRecorder) GetBuffer

func (mr *GoMockDiskStorageMockRecorder) GetBuffer() *gomock.Call

GetBuffer indicates an expected call of GetBuffer.

func (*GoMockDiskStorageMockRecorder) ResetBuffer

func (mr *GoMockDiskStorageMockRecorder) ResetBuffer() *gomock.Call

ResetBuffer indicates an expected call of ResetBuffer.

func (*GoMockDiskStorageMockRecorder) Write

func (mr *GoMockDiskStorageMockRecorder) Write(chunk interface{}) *gomock.Call

Write indicates an expected call of Write.

func (*GoMockDiskStorageMockRecorder) WriteFile

func (mr *GoMockDiskStorageMockRecorder) WriteFile(filePath, perm interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type MockHTTPClient

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

MockHTTPClient is a mock of HTTPClient interface.

func NewMockHTTPClient

func NewMockHTTPClient(ctrl *gomock.Controller) *MockHTTPClient

NewMockHTTPClient creates a new mock instance.

func (*MockHTTPClient) Do

func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error)

Do mocks base method.

func (*MockHTTPClient) EXPECT

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

type MockHTTPClientMockRecorder

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

MockHTTPClientMockRecorder is the mock recorder for MockHTTPClient.

func (*MockHTTPClientMockRecorder) Do

func (mr *MockHTTPClientMockRecorder) Do(req interface{}) *gomock.Call

Do indicates an expected call of Do.

type Option

type Option func(d *diskStorage) error

Option configures diskStorage.

func WithBuffer

func WithBuffer(b *bytes.Buffer) Option

WithBuffer returns an option that set the buffer value.

func WithHTTPClient

func WithHTTPClient(httpClient HTTPClient) Option

WithHTTPClient returns an option that set the http client.

Jump to

Keyboard shortcuts

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