commons

package
v5.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns first non-loopback IP address

func KeySet

func KeySet(m map[string]interface{}) []string

KeySet returns array of map keys

func Retry

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

Retry executes callback func until it executes successfully

func Schedule

func Schedule(timeout time.Duration, noDelay bool, callback func()) chan<- struct{}

Schedule executes callback func with some period. no delays force callback to execute first time immediately Function returns channel to stop scheduled execution

func ShutdownHook

func ShutdownHook(hook func() error)

ShutdownHook adds function to be performed on app shutdown

Types

type BuildInfo

type BuildInfo struct {
	Version   string `json:"version,omitempty"`
	Branch    string `json:"branch,omitempty"`
	BuildDate string `json:"build_date,omitempty"`
	Name      string `json:"name,omitempty"`
	Repo      string `json:"repo,omitempty"`
}

BuildInfo contains information about the current build

func GetBuildInfo

func GetBuildInfo() *BuildInfo

GetBuildInfo returns build info data

Jump to

Keyboard shortcuts

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