filemanager

package
v0.0.0-...-0117b6e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 20

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

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

func (FileSystemImpl) ReadFile

func (f FileSystemImpl) ReadFile(filename string) (string, error)

ReadFile reads the contents of file in path provided

func (FileSystemImpl) WriteFile

func (f FileSystemImpl) WriteFile(filename string, content string) error

WriteFile writes the content in the file path provided

Directories

Path Synopsis
Package fileutil_mock has mock functions for filemanager package
Package fileutil_mock has mock functions for filemanager package

Jump to

Keyboard shortcuts

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