Documentation ¶
Overview ¶
Package helper contains generally-useful helper methods.
Index ¶
- func CheckErr(err error)
- func CleanupWithError(tx *sql.Tx, err error) error
- func ClearDirectory(path string, skipFiles ...string) error
- func ContainsDoNotPrintHelp(err error) bool
- func DoNotPrintHelp(err error) error
- func DoesPathExist(path string) bool
- func DoesPathExistErr(path string) (bool, error)
- func Getwd() string
- func MoveFile(sourcePath, destPath string) error
- func PrettyJSON(i interface{}) []byte
- func PrettyJSONString(i interface{}) string
- func PrintAsJSON(i interface{})
- func Printwd()
- func RequireAbsolutePathExisting(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupWithError ¶
CleanupWithError rolls the given transaction back and if that returns errors it combines the given error and the new.
func ClearDirectory ¶
ClearDirectory clears the directory of all files and folders except the listed ones. Can only keep files directly inside the folder.
func ContainsDoNotPrintHelp ¶
ContainsDoNotPrintHelp says whether the given error says to not print help.
func DoesPathExist ¶
DoesPathExist checks whether the given path exists inside the file system.
func DoesPathExistErr ¶
DoesPathExistErr returns whether the given file or directory exists
func PrettyJSON ¶
func PrettyJSON(i interface{}) []byte
PrettyJSON returns the given data structure as json.
Crashes if json marshalling failed.
func PrettyJSONString ¶
func PrettyJSONString(i interface{}) string
PrettyJSONString returns the given data structure as json.
Crashes if json marshalling failed.
func PrintAsJSON ¶
func PrintAsJSON(i interface{})
PrintAsJSON prints the given object as indented json.
func RequireAbsolutePathExisting ¶
RequireAbsolutePathExisting makes sure the given path is absolute and does actually exist inside the filesystem.
Types ¶
This section is empty.