Documentation ¶
Index ¶
- func AddSyslogHook()
- func CopyFileContents(src, dst string) (err error)
- func DirectWriteJson(ctx context.Context, file string, obj interface{}) error
- func EnforcePermission(dirPath string) error
- func False() *bool
- func FileExists(path string) bool
- func InitLog(logLevel string, logPath string) error
- func IsAdmin() bool
- func ReadJson(file string, res interface{}) (interface{}, error)
- func ReadJsonWithEnvSub(file string, res interface{}) (interface{}, error)
- func Retry(attempts int, sleep time.Duration, toExec func() error, onError func(e error)) error
- func ReturnBoolWithDefaultFalse(b *bool) bool
- func ReturnBoolWithDefaultTrue(b *bool) bool
- func SliceDiff(x, y []string) []string
- func True() *bool
- func WriteBytesWithRestrictedPermission(ctx context.Context, file string, bs []byte) error
- func WriteJson(ctx context.Context, file string, obj interface{}) error
- func WriteJsonWithRestrictedPermission(ctx context.Context, file string, obj interface{}) error
- type Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSyslogHook ¶ added in v0.28.5
func AddSyslogHook()
func CopyFileContents ¶
CopyFileContents copies contents of the given src file to the dst file
func DirectWriteJson ¶ added in v0.23.3
DirectWriteJson writes JSON config object to a file creating parent directories if required without creating a temporary file
func EnforcePermission ¶ added in v0.29.3
func False ¶ added in v0.26.0
func False() *bool
False returns a *bool whose underlying value is false.
func FileExists ¶ added in v0.8.1
FileExists returns true if specified file exists
func ReadJsonWithEnvSub ¶ added in v0.30.1
ReadJsonWithEnvSub reads JSON config file and maps to a provided interface with environment variable substitution
func Retry ¶
Retry retries a given toExec function calling onError on failed attempts onError shouldn be a lightweight function and shouldn't be blocking
func ReturnBoolWithDefaultFalse ¶ added in v0.26.0
Return bool representation if the bool pointer is non-nil, otherwise returns false
func ReturnBoolWithDefaultTrue ¶ added in v0.26.0
Return bool representation if the bool pointer is non-nil, otherwise returns true
func WriteBytesWithRestrictedPermission ¶ added in v0.32.0
Types ¶
type Duration ¶
Duration is used strictly for JSON requests/responses due to duration marshalling issues