Documentation
¶
Index ¶
- func CopyFile(srcFile, dstFile string) (err error)
- func CreateTempDir(dirPattern string) (string, error)
- func DirFileFilterDefaultFunc(filePath string, isDir bool) bool
- func GenerateAbsFilePath(baseDir, file string) (string, error)
- func GetFileAbsDirPath(fileLoc string) (string, error)
- func GetFileAbsDirPathOrDirItself(fileLoc string) (string, error)
- func GetFileMap(srcPath string, filterFunc DirFileFilterFunc, fileNameFunc DirFileNameFunc, ...) (map[string][]byte, error)
- func GetFileMapByWalkDir(srcPath string, filterFunc DirFileFilterFunc, fileNameFunc DirFileNameFunc, ...) (map[string][]byte, error)
- func GetYamlNodeStrByPath(content []byte, path string) (string, error)
- func ReadYamls(path string) ([]byte, error)
- func RemoveFileIfExists(filename string) error
- func ReplaceAppNameInPathStr(filePath, appNamePlaceHolder, appName string) string
- type DirFileContentFunc
- type DirFileFilterFunc
- type DirFileNameFunc
- type YamlSequenceNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTempDir ¶ added in v0.10.0
func DirFileFilterDefaultFunc ¶ added in v0.10.2
DirFileFilterDefaultFunc is used for GetFileMap it will return false if isDir is true
func GenerateAbsFilePath ¶ added in v0.10.0
GenerateAbsFilePath return all the path with a given file name
func GetFileAbsDirPath ¶ added in v0.10.0
GetFileAbsDirPath will return abs dir path for file
func GetFileAbsDirPathOrDirItself ¶ added in v0.10.3
GetFileAbsDirPathOrDirItself will return abs dir path, for file: return its parent directory for directory: return dir itself
func GetFileMap ¶ added in v0.10.0
func GetFileMap( srcPath string, filterFunc DirFileFilterFunc, fileNameFunc DirFileNameFunc, fileContentFunc DirFileContentFunc, ) (map[string][]byte, error)
GetFileMap return map of fileName and content if srcPath is a directory, it will invoke GetFileMapByWalkDir to get content map if srcPath is a file, it will use fileNameFunc and fileContentFunc to create a map
func GetFileMapByWalkDir ¶ added in v0.10.0
func GetFileMapByWalkDir( srcPath string, filterFunc DirFileFilterFunc, fileNameFunc DirFileNameFunc, processFunc DirFileContentFunc, ) (map[string][]byte, error)
GetFileMapByWalkDir will walk in directory return contentMap
func GetYamlNodeStrByPath ¶ added in v0.10.0
GetYamlNodeStrByPath get element from yaml content by yaml path return string format of node
func ReadYamls ¶ added in v0.10.3
ReadYamls reads file or files from dir whose suffix is yaml or yml and returns the content of the files without "---" separator
func RemoveFileIfExists ¶ added in v0.10.0
func ReplaceAppNameInPathStr ¶ added in v0.9.0
Types ¶
type DirFileContentFunc ¶ added in v0.10.0
DirFileContentFunc is used to get file content then return this content
type DirFileFilterFunc ¶ added in v0.10.3
DirFileFilterFunc is used to filter files when walk directory if this func return false, this file's content will not return
type DirFileNameFunc ¶ added in v0.9.0
DirFileNameFunc is used to make current filename to become map key srcPath is the basePath of file, for sometimes you may want to get relativePath of filePath
type YamlSequenceNode ¶ added in v0.10.0
YamlSequenceNode is yaml sequenceNode
func GetYamlNodeArrayByPath ¶ added in v0.10.0
func GetYamlNodeArrayByPath(content []byte, path string) (*YamlSequenceNode, error)
GetYamlNodeArrayByPath get element from yaml content by yaml path return string array for elements
func MergeYamlNode ¶ added in v0.10.0
func MergeYamlNode(dst *YamlSequenceNode, src *YamlSequenceNode) *YamlSequenceNode
func (*YamlSequenceNode) IsEmpty ¶ added in v0.10.0
func (n *YamlSequenceNode) IsEmpty() bool
IsEmpty check node fields are empty