Documentation
¶
Overview ¶
Package filesystem provides an abstraction around a filesystem
Index ¶
- type File
- type Filesystem
- type MockFS
- func (fs *MockFS) Create(name string) (File, error)
- func (fs *MockFS) Link(oldname, newname string) error
- func (fs *MockFS) Mkdir(name string, perm os.FileMode) error
- func (fs *MockFS) MkdirAll(path string, perm os.FileMode) error
- func (fs *MockFS) Open(name string) (File, error)
- func (fs *MockFS) Remove(name string) error
- func (fs *MockFS) Rename(oldpath, newpath string) error
- func (fs *MockFS) Stat(name string) (os.FileInfo, error)
- func (fs *MockFS) TempFile(dir, pattern string) (File, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface {
io.Reader
io.Closer
io.Writer
io.ReaderAt
io.Seeker
Name() string
Readdir(int) ([]os.FileInfo, error)
Stat() (os.FileInfo, error)
}
File represents a file object.
type Filesystem ¶
type Filesystem interface {
Mkdir(name string, perm os.FileMode) error
MkdirAll(path string, perm os.FileMode) error
Open(string) (File, error)
Create(string) (File, error)
Stat(string) (os.FileInfo, error)
TempFile(dir, pattern string) (File, error)
Rename(oldpath, newpath string) error
Remove(name string) error
Link(oldname, newname string) error
}
Filesystem is a filesystem implemenatation.
type MockFS ¶
type MockFS struct {
MkdirFunc func(string, os.FileMode) error
MkdirAllFunc func(string, os.FileMode) error
CreateFunc func(string) (File, error)
OpenFunc func(string) (File, error)
StatFunc func(string) (os.FileInfo, error)
TempFileFunc func(string, string) (File, error)
RenameFunc func(string, string) error
RemoveFunc func(string) error
LinkFunc func(string, string) error
}
MockFS allows mocking a filesystem.
Click to show internal directories.
Click to hide internal directories.