Documentation
¶
Index ¶
- func Confirm(prompt string) bool
- func Do(domain, uri, method, accessToken string, post []byte) error
- func DoBody(domain, uri, method, accessToken string, post []byte) ([]byte, error)
- func DoBodyAddHeader(domain, uri, method, accessToken string, headers map[string]string, ...) ([]byte, error)
- func EnvDefault(key, defVal string) string
- func FileExist(path string) bool
- func GetByteStream(s string) (bt []byte, err error)
- func GetFile(s string) (bt []byte, err error)
- func HasJSONPrefix(buf []byte) bool
- func IsEnvSet(key string) bool
- func IsUrl(u string) (url.URL, bool)
- func JsonConvert(from interface{}, to interface{}) error
- func ProcessError(err error) error
- func ReadByteFrom(in io.Reader) (bt []byte, err error)
- func ReadStringFromFile(s string) string
- func Retry(fn Func, retries int, sleep time.Duration, thundering bool) error
- type Func
- type HTTPFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoBodyAddHeader ¶
func EnvDefault ¶
func GetByteStream ¶
GetByteStream is read file/url/stdin to []byte stream
func HasJSONPrefix ¶
func JsonConvert ¶
func JsonConvert(from interface{}, to interface{}) error
func ProcessError ¶
func ReadStringFromFile ¶
func Retry ¶
Do runs the passed function until the number of retries is reached. Whenever Func returns err it will sleep and Func will be executed again in a recursive fashion. The sleep value is slightly modified on every retry (exponential backoff) to prevent the thundering herd problem (https://en.wikipedia.org/wiki/Thundering_herd_problem). If no value is given to sleep it will defaults to 500ms.
Types ¶
Click to show internal directories.
Click to hide internal directories.