file

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package file is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileClosed        = errors.New("File is closed")
	ErrOutOfRange        = errors.New("out of range")
	ErrTooLarge          = errors.New("too large")
	ErrFileNotFound      = os.ErrNotExist
	ErrFileExists        = os.ErrExist
	ErrDestinationExists = os.ErrExist
)

Functions

This section is empty.

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	io.WriterAt

	ReadAll() (RowReader, error)
}

File represents a file in the filesystem.

type FileInfo

type FileInfo interface {
	Name() string       // base name of the file
	Size() int64        // length in bytes for regular files; system-dependent for others
	ModTime() time.Time // modification time
	Mode() os.FileMode  // file mode bits
	IsDir() bool        // abbreviation for Mode().IsDir()
}

type FileSystem

type FileSystem interface {
	// Create creates a file in the filesystem, returning the file and an
	// error, if any happens.
	Create(name string) (File, error)

	// TODO - Lets make bucket constant for MkdirAll as well, we might create buckets from migrations
	// Mkdir creates a directory in the filesystem, return an error if any
	// happens.
	Mkdir(name string, perm os.FileMode) error

	// MkdirAll creates a directory path and all parents that does not exist
	// yet.
	MkdirAll(path string, perm os.FileMode) error

	// Open opens a file, returning it or an error, if any happens.
	Open(name string) (File, error)

	// OpenFile opens a file using the given flags and the given mode.
	OpenFile(name string, flag int, perm os.FileMode) (File, error)

	// Remove removes a file identified by name, returning an error, if any
	// happens.
	Remove(name string) error

	// RemoveAll removes a directory path and any children it contains. It
	// does not fail if the path does not exist (return nil).
	RemoveAll(path string) error

	// Rename renames a file.
	Rename(oldname, newname string) error

	// ReadDir returns a list of files/directories present in the directory.
	ReadDir(dir string) ([]FileInfo, error)

	// Stat returns the file/directory information in the directory.
	Stat(name string) (FileInfo, error)

	// ChDir changes the current directory.
	ChDir(dirname string) error

	// Getwd returns the path of the current directory.
	Getwd() (string, error)
}

FileSystem : Any simulated or real filesystem should implement this interface.

func New

func New(logger datasource.Logger) FileSystem

New initializes local filesystem with logger.

type FileSystemProvider

type FileSystemProvider interface {
	FileSystem

	// UseLogger sets the logger for the FileSystem client.
	UseLogger(logger interface{})

	// UseMetrics sets the metrics for the FileSystem client.
	UseMetrics(metrics interface{})

	// Connect establishes a connection to FileSystem and registers metrics using the provided configuration when the client was Created.
	Connect()
}

type MockFile

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

MockFile is a mock of File interface.

func NewMockFile

func NewMockFile(ctrl *gomock.Controller) *MockFile

NewMockFile creates a new mock instance.

func (*MockFile) Close

func (m *MockFile) Close() error

Close mocks base method.

func (*MockFile) EXPECT

func (m *MockFile) EXPECT() *MockFileMockRecorder

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

func (*MockFile) Read

func (m *MockFile) Read(p []byte) (int, error)

Read mocks base method.

func (*MockFile) ReadAll

func (m *MockFile) ReadAll() (RowReader, error)

ReadAll mocks base method.

func (*MockFile) ReadAt

func (m *MockFile) ReadAt(p []byte, off int64) (int, error)

ReadAt mocks base method.

func (*MockFile) Seek

func (m *MockFile) Seek(offset int64, whence int) (int64, error)

Seek mocks base method.

func (*MockFile) Write

func (m *MockFile) Write(p []byte) (int, error)

Write mocks base method.

func (*MockFile) WriteAt

func (m *MockFile) WriteAt(p []byte, off int64) (int, error)

WriteAt mocks base method.

type MockFileMockRecorder

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

MockFileMockRecorder is the mock recorder for MockFile.

func (*MockFileMockRecorder) Close

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

Close indicates an expected call of Close.

func (*MockFileMockRecorder) Read

func (mr *MockFileMockRecorder) Read(p any) *gomock.Call

Read indicates an expected call of Read.

func (*MockFileMockRecorder) ReadAll

func (mr *MockFileMockRecorder) ReadAll() *gomock.Call

ReadAll indicates an expected call of ReadAll.

func (*MockFileMockRecorder) ReadAt

func (mr *MockFileMockRecorder) ReadAt(p, off any) *gomock.Call

ReadAt indicates an expected call of ReadAt.

func (*MockFileMockRecorder) Seek

func (mr *MockFileMockRecorder) Seek(offset, whence any) *gomock.Call

Seek indicates an expected call of Seek.

func (*MockFileMockRecorder) Write

func (mr *MockFileMockRecorder) Write(p any) *gomock.Call

Write indicates an expected call of Write.

func (*MockFileMockRecorder) WriteAt

func (mr *MockFileMockRecorder) WriteAt(p, off any) *gomock.Call

WriteAt indicates an expected call of WriteAt.

type MockFileSystem

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

MockFileSystem is a mock of FileSystem interface.

func NewMockFileSystem

func NewMockFileSystem(ctrl *gomock.Controller) *MockFileSystem

NewMockFileSystem creates a new mock instance.

func (*MockFileSystem) Create

func (m *MockFileSystem) Create(name string) (File, error)

Create mocks base method.

func (*MockFileSystem) EXPECT

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

func (*MockFileSystem) Mkdir

func (m *MockFileSystem) Mkdir(name string, perm os.FileMode) error

Mkdir mocks base method.

func (*MockFileSystem) MkdirAll

func (m *MockFileSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll mocks base method.

func (*MockFileSystem) Open

func (m *MockFileSystem) Open(name string) (File, error)

Open mocks base method.

func (*MockFileSystem) OpenFile

func (m *MockFileSystem) OpenFile(name string, flag int, perm os.FileMode) (File, error)

OpenFile mocks base method.

func (*MockFileSystem) Remove

func (m *MockFileSystem) Remove(name string) error

Remove mocks base method.

func (*MockFileSystem) RemoveAll

func (m *MockFileSystem) RemoveAll(path string) error

RemoveAll mocks base method.

func (*MockFileSystem) Rename

func (m *MockFileSystem) Rename(oldname, newname string) error

Rename mocks base method.

type MockFileSystemMockRecorder

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

MockFileSystemMockRecorder is the mock recorder for MockFileSystem.

func (*MockFileSystemMockRecorder) Create

func (mr *MockFileSystemMockRecorder) Create(name any) *gomock.Call

Create indicates an expected call of Create.

func (*MockFileSystemMockRecorder) Mkdir

func (mr *MockFileSystemMockRecorder) Mkdir(name, perm any) *gomock.Call

Mkdir indicates an expected call of Mkdir.

func (*MockFileSystemMockRecorder) MkdirAll

func (mr *MockFileSystemMockRecorder) MkdirAll(path, perm any) *gomock.Call

MkdirAll indicates an expected call of MkdirAll.

func (*MockFileSystemMockRecorder) Open

func (mr *MockFileSystemMockRecorder) Open(name any) *gomock.Call

Open indicates an expected call of Open.

func (*MockFileSystemMockRecorder) OpenFile

func (mr *MockFileSystemMockRecorder) OpenFile(name, flag, perm any) *gomock.Call

OpenFile indicates an expected call of OpenFile.

func (*MockFileSystemMockRecorder) Remove

func (mr *MockFileSystemMockRecorder) Remove(name any) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockFileSystemMockRecorder) RemoveAll

func (mr *MockFileSystemMockRecorder) RemoveAll(path any) *gomock.Call

RemoveAll indicates an expected call of RemoveAll.

func (*MockFileSystemMockRecorder) Rename

func (mr *MockFileSystemMockRecorder) Rename(oldname, newname any) *gomock.Call

Rename indicates an expected call of Rename.

type MockFileSystemProvider

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

MockFileSystemProvider is a mock of FileSystemProvider interface.

func NewMockFileSystemProvider

func NewMockFileSystemProvider(ctrl *gomock.Controller) *MockFileSystemProvider

NewMockFileSystemProvider creates a new mock instance.

func (*MockFileSystemProvider) ChDir

func (m *MockFileSystemProvider) ChDir(arg0 string) error

ChDir mocks base method.

func (*MockFileSystemProvider) Connect

func (m *MockFileSystemProvider) Connect()

Connect mocks base method.

func (*MockFileSystemProvider) Create

func (m *MockFileSystemProvider) Create(name string) (File, error)

Create mocks base method.

func (*MockFileSystemProvider) EXPECT

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

func (*MockFileSystemProvider) Getwd

func (m *MockFileSystemProvider) Getwd() (string, error)

Getwd mocks base method.

func (*MockFileSystemProvider) Mkdir

func (m *MockFileSystemProvider) Mkdir(name string, perm os.FileMode) error

Mkdir mocks base method.

func (*MockFileSystemProvider) MkdirAll

func (m *MockFileSystemProvider) MkdirAll(path string, perm os.FileMode) error

MkdirAll mocks base method.

func (*MockFileSystemProvider) Open

func (m *MockFileSystemProvider) Open(name string) (File, error)

Open mocks base method.

func (*MockFileSystemProvider) OpenFile

func (m *MockFileSystemProvider) OpenFile(name string, flag int, perm os.FileMode) (File, error)

OpenFile mocks base method.

func (*MockFileSystemProvider) ReadDir

func (m *MockFileSystemProvider) ReadDir(arg0 string) ([]FileInfo, error)

ReadDir mocks base method.

func (*MockFileSystemProvider) Remove

func (m *MockFileSystemProvider) Remove(name string) error

Remove mocks base method.

func (*MockFileSystemProvider) RemoveAll

func (m *MockFileSystemProvider) RemoveAll(path string) error

RemoveAll mocks base method.

func (*MockFileSystemProvider) Rename

func (m *MockFileSystemProvider) Rename(oldname, newname string) error

Rename mocks base method.

func (*MockFileSystemProvider) Stat

func (m *MockFileSystemProvider) Stat(arg0 string) (FileInfo, error)

Stat mocks base method.

func (*MockFileSystemProvider) UseLogger

func (m *MockFileSystemProvider) UseLogger(logger any)

UseLogger mocks base method.

func (*MockFileSystemProvider) UseMetrics

func (m *MockFileSystemProvider) UseMetrics(metrics any)

UseMetrics mocks base method.

type MockFileSystemProviderMockRecorder

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

MockFileSystemProviderMockRecorder is the mock recorder for MockFileSystemProvider.

func (*MockFileSystemProviderMockRecorder) ChDir

ChDir indicates an expected call of ChDir.

func (*MockFileSystemProviderMockRecorder) Connect

Connect indicates an expected call of Connect.

func (*MockFileSystemProviderMockRecorder) Create

Create indicates an expected call of Create.

func (*MockFileSystemProviderMockRecorder) Getwd

Getwd indicates an expected call of Getwd.

func (*MockFileSystemProviderMockRecorder) Mkdir

func (mr *MockFileSystemProviderMockRecorder) Mkdir(name, perm any) *gomock.Call

Mkdir indicates an expected call of Mkdir.

func (*MockFileSystemProviderMockRecorder) MkdirAll

func (mr *MockFileSystemProviderMockRecorder) MkdirAll(path, perm any) *gomock.Call

MkdirAll indicates an expected call of MkdirAll.

func (*MockFileSystemProviderMockRecorder) Open

Open indicates an expected call of Open.

func (*MockFileSystemProviderMockRecorder) OpenFile

func (mr *MockFileSystemProviderMockRecorder) OpenFile(name, flag, perm any) *gomock.Call

OpenFile indicates an expected call of OpenFile.

func (*MockFileSystemProviderMockRecorder) ReadDir

ReadDir indicates an expected call of ReadDir.

func (*MockFileSystemProviderMockRecorder) Remove

Remove indicates an expected call of Remove.

func (*MockFileSystemProviderMockRecorder) RemoveAll

func (mr *MockFileSystemProviderMockRecorder) RemoveAll(path any) *gomock.Call

RemoveAll indicates an expected call of RemoveAll.

func (*MockFileSystemProviderMockRecorder) Rename

func (mr *MockFileSystemProviderMockRecorder) Rename(oldname, newname any) *gomock.Call

Rename indicates an expected call of Rename.

func (*MockFileSystemProviderMockRecorder) Stat

Stat indicates an expected call of Stat.

func (*MockFileSystemProviderMockRecorder) UseLogger

func (mr *MockFileSystemProviderMockRecorder) UseLogger(logger any) *gomock.Call

UseLogger indicates an expected call of UseLogger.

func (*MockFileSystemProviderMockRecorder) UseMetrics

func (mr *MockFileSystemProviderMockRecorder) UseMetrics(metrics any) *gomock.Call

UseMetrics indicates an expected call of UseMetrics.

type MockRowReader

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

MockRowReader is a mock of RowReader interface.

func NewMockRowReader

func NewMockRowReader(ctrl *gomock.Controller) *MockRowReader

NewMockRowReader creates a new mock instance.

func (*MockRowReader) EXPECT

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

func (*MockRowReader) Next

func (m *MockRowReader) Next() bool

Next mocks base method.

func (*MockRowReader) Scan

func (m *MockRowReader) Scan(arg0 any) error

Scan mocks base method.

type MockRowReaderMockRecorder

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

MockRowReaderMockRecorder is the mock recorder for MockRowReader.

func (*MockRowReaderMockRecorder) Next

Next indicates an expected call of Next.

func (*MockRowReaderMockRecorder) Scan

func (mr *MockRowReaderMockRecorder) Scan(arg0 any) *gomock.Call

Scan indicates an expected call of Scan.

type RowReader

type RowReader interface {
	Next() bool
	Scan(interface{}) error
}

Jump to

Keyboard shortcuts

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