Documentation ¶
Overview ¶
Package common contains utility functions for collections, maps and filesystem.
Index ¶
- func Contains(s []string, str string) bool
- func CopyFileFromEmbeddedFS(efs *embed.FS, fs afero.Fs, pathToFile string, saveTo string) error
- func Difference(a, b []string) []string
- func DirExists(fs afero.Fs, path string) bool
- func FileExists(fs afero.Fs, path string) (bool, error)
- func MkDir(fs afero.Fs, x ...string) error
- func MoveFile(efs *embed.FS, fs afero.Fs, sourceFile string, saveTo string, backup bool) error
- func ReadFileLineByLine(appFs afero.Fs, filepath string) ([]string, error)
- func RemoveEmpty(s []string) []string
- func TouchFile(fs afero.Fs, x ...string) error
- func Union(a, b []string) []string
- func UnionMap(m1, m2 map[string]string) map[string]string
- func Unique(s []string) []string
- func WriteToDisk(fs afero.Fs, inpath string, r io.Reader) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFileFromEmbeddedFS ¶
CopyFileFromEmbeddedFS copy files from the embedded file system to the actual file system.
func Difference ¶ added in v0.9.0
Difference returns the elements in `a` that aren't in `b`.
func FileExists ¶
FileExists returns true if the file exists.
func MoveFile ¶ added in v0.7.0
MoveFile copy files from the embedded file system to the actual file system and can backups them.
func ReadFileLineByLine ¶ added in v0.5.2
ReadFileLineByLine returns a slice of strings representing lines of the input file.
func RemoveEmpty ¶ added in v0.11.0
RemoveEmpty delete an empty value in a slice of strings.
func Union ¶ added in v0.5.2
Union returns a slice containing the unique values of the input slices.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.