utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

JSON fascade for abstraction of json marshalling and unmarhalling

Functions

func AppendFile

func AppendFile(absPath string, data []byte) bool

AppendFile appens data given absolute path to a file, creates it if it does not exist

func CountFiles

func CountFiles(absPath string) int

CountFiles returns number of items in directory

func DeleteFile

func DeleteFile(absPath string) bool

DeleteFile removes file given absolute path if that file does exists

func Exists

func Exists(absPath string) bool

Exists returns true if absolute path exists

func ListDirectory

func ListDirectory(absPath string, ascending bool) ([]string, error)

ListDirectory returns sorted slice of item names in given absolute path default sorting is ascending

func NotifyServiceReady

func NotifyServiceReady()

NotifyServiceReady notify underlying os that service is ready

func NotifyServiceStopping

func NotifyServiceStopping()

NotifyServiceStopping notify underlying os that service is stopping

func ReadFileFully

func ReadFileFully(absPath string) ([]byte, error)

ReadFileFully reads whole file given absolute path

func Retry

func Retry(attempts int, sleep time.Duration, callback func() error) (err error)

func TokenPath

func TokenPath(root, value string) string

TokenPath returns filepath for token

func TokensPath

func TokensPath(root string) string

TokensPath returns filepath for tokens

func TouchFile

func TouchFile(absPath string) bool

TouchFile creates files given absolute path if file does not already exist

func UpdateFile

func UpdateFile(absPath string, data []byte) bool

UpdateFile rewrite file with data given absolute path to a file if that file exist

func WriteFile

func WriteFile(absPath string, data []byte) bool

WriteFile writes data given absolute path to a file if that file does not already exists

Types

type LogFormat

type LogFormat struct {
}

LogFormat is a custom logging formater for logrus

func (*LogFormat) Format

func (f *LogFormat) Format(entry *log.Entry) ([]byte, error)

Format processed each log entry and produces formatted log line

Jump to

Keyboard shortcuts

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