files

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(New, NewOptions)

Functions

func GetFileAbsPath

func GetFileAbsPath(base, fileName string) (fileAbsPath string, err error)

Types

type FileManager

type FileManager interface {
	SetBase(base string)
	GetBase() string
	CreateFile(fileName string, bytes []byte) error
	CreateDirectory(fileName string) error
	FetchFile(fileName string) ([]byte, error)
	FetchFileInfo(fileName string) (os.FileInfo, error)
	IsFileExists(fileName string) (bool, error)
	IsDirectoryExists(fileName string) (bool, error)
	GetFilesAndDirs(dirname string) ([]string, []string, error)

	ArchiveDirectory(fileName string) (file *os.File, err error)
}

func New

func New(o *Options) (FileManager, error)

New for file library

type LocalFileManager

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

func (*LocalFileManager) ArchiveDirectory

func (m *LocalFileManager) ArchiveDirectory(fileName string) (file *os.File, err error)

func (*LocalFileManager) CreateDirectory

func (m *LocalFileManager) CreateDirectory(fileName string) (err error)

func (*LocalFileManager) CreateFile

func (m *LocalFileManager) CreateFile(fileName string, bytes []byte) (err error)

func (*LocalFileManager) FetchFile

func (m *LocalFileManager) FetchFile(fileName string) ([]byte, error)

func (*LocalFileManager) FetchFileBytes

func (m *LocalFileManager) FetchFileBytes(fileName string) ([]byte, error)

func (*LocalFileManager) FetchFileInfo

func (m *LocalFileManager) FetchFileInfo(fileName string) (os.FileInfo, error)

func (*LocalFileManager) GetBase

func (m *LocalFileManager) GetBase() string

func (*LocalFileManager) GetFilesAndDirs

func (m *LocalFileManager) GetFilesAndDirs(dsirname string) (files []string, dirs []string, err error)

func (*LocalFileManager) IsDirectoryExists

func (m *LocalFileManager) IsDirectoryExists(fileName string) (bool, error)

func (*LocalFileManager) IsFileExists

func (m *LocalFileManager) IsFileExists(filePath string) (bool, error)

func (*LocalFileManager) SetBase

func (m *LocalFileManager) SetBase(base string)

type Options

type Options struct {
	Type string `yaml:"type"`
	Base string `yaml:"base"`
}

Options is log configuration struct

func NewOptions

func NewOptions(v *viper.Viper, logger *zap.Logger) (*Options, error)

Jump to

Keyboard shortcuts

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