Documentation
¶
Overview ¶
TODO: This package is a start to migration of the fileutil code to be inside an interface for better mocking. Package filemanager have all the file related dependencies used by the execute package
Index ¶
- type FileSystem
- type FileSystemImpl
- func (f FileSystemImpl) AppendToFile(fileDirectory string, filename string, content string) (filePath string, err error)
- func (f FileSystemImpl) CreateFile(name string) (*os.File, error)
- func (f FileSystemImpl) CreateTempDir(dir, prefix string) (name string, err error)
- func (f FileSystemImpl) DeleteDirectory(directory string) (err error)
- func (f FileSystemImpl) DeleteFile(filename string) (err error)
- func (f FileSystemImpl) Exists(root string) bool
- func (f FileSystemImpl) IsDirectory(srcPath string) bool
- func (f FileSystemImpl) MakeDirs(destinationDir string) (err error)
- func (f FileSystemImpl) MoveAndRenameFile(sourcePath, sourceName, destPath, destName string) (result bool, err error)
- func (f FileSystemImpl) ReadFile(filename string) (string, error)
- func (f FileSystemImpl) WriteFile(filename string, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface { CreateFile(name string) (*os.File, error) MakeDirs(destinationDir string) (err error) CreateTempDir(dir, prefix string) (name string, err error) WriteFile(filename string, content string) error ReadFile(filename string) (string, error) MoveAndRenameFile(sourcePath, sourceName, destPath, destName string) (result bool, err error) DeleteFile(filename string) (err error) DeleteDirectory(directory string) (err error) Exists(filename string) bool IsDirectory(srcPath string) bool AppendToFile(fileDirectory string, filename string, content string) (filePath string, err error) }
FileSystem implements dependency on filesystem and os utility functions
type FileSystemImpl ¶
type FileSystemImpl struct{}
func (FileSystemImpl) AppendToFile ¶
func (f FileSystemImpl) AppendToFile(fileDirectory string, filename string, content string) (filePath string, err error)
AppendToFile appends contents to file
func (FileSystemImpl) CreateFile ¶
func (f FileSystemImpl) CreateFile(name string) (*os.File, error)
CreateFile creates file with the given name
func (FileSystemImpl) CreateTempDir ¶
func (f FileSystemImpl) CreateTempDir(dir, prefix string) (name string, err error)
CreateTempDir creates a directory relative to the given dir having the given prefix
func (FileSystemImpl) DeleteDirectory ¶
func (f FileSystemImpl) DeleteDirectory(directory string) (err error)
DeleteDirectory recursively deletes the directory
func (FileSystemImpl) DeleteFile ¶
func (f FileSystemImpl) DeleteFile(filename string) (err error)
DeleteFile deletes the file
func (FileSystemImpl) Exists ¶
func (f FileSystemImpl) Exists(root string) bool
func (FileSystemImpl) IsDirectory ¶
func (f FileSystemImpl) IsDirectory(srcPath string) bool
func (FileSystemImpl) MakeDirs ¶
func (f FileSystemImpl) MakeDirs(destinationDir string) (err error)
MakeDirs creates a directory with execute access
func (FileSystemImpl) MoveAndRenameFile ¶
func (f FileSystemImpl) MoveAndRenameFile(sourcePath, sourceName, destPath, destName string) (result bool, err error)
MoveAndRenameFile moves and renames the file
Click to show internal directories.
Click to hide internal directories.