common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFilePermissions fs.FileMode = 0o600
	DefaultDirPermissions  fs.FileMode = 0o755
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem interface {
	GetLocalExecutable(name string) (string, error)

	FileExists(filename string) (bool, error)
	WriteFile(filename string, content []byte) error
	WriteLockFileFunc(filename string, writeFunc func(io.Writer) error) (LockFile, error)
	DeleteFile(filename string) (bool, error)
	ReadFileLines(filename string) ([]string, error)

	// ReadDirRecursive recurses into a given directory ('path') up to 'depth'
	// levels deep. If 'strictDepth' is true, only the entries at *exactly* the
	// given depth are returned (if any). If 'strictDepth' is false, though, the
	// results will also include any files or empty directories for a depth <
	// 'depth'.
	//
	// If 'depth' is <= 0, ReadDirRecursive returns an empty list.
	ReadDirRecursive(path string, depth int, strictDepth bool) ([]ReadDirEntry, error)
}

func NewFileSystem

func NewFileSystem() FileSystem

type LockFile

type LockFile interface {
	Commit() error
	Rollback() error
}

type ReadDirEntry

type ReadDirEntry interface {
	Path() string
	fs.DirEntry
}

type UserProvider

type UserProvider interface {
	CurrentUser() (*user.User, error)
}

func NewUserProvider

func NewUserProvider() UserProvider

Jump to

Keyboard shortcuts

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