utils

package
v0.0.0-...-1e118f8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

GenRandAll .

View Source
const GenRandDigit = 1 << 2

GenRandDigit .

View Source
const GenRandLower = 1 << 0

GenRandLower .

View Source
const GenRandLowerDigit = GenRandLower | GenRandDigit

GenRandLowerDigit .

View Source
const GenRandLowerUpper = GenRandLower | GenRandUpper

GenRandLowerUpper .

View Source
const GenRandLowerUpperDigit = GenRandLowerUpper | GenRandDigit

GenRandLowerUpperDigit .

View Source
const GenRandNone = 0

GenRandNone .

View Source
const GenRandSymbol = 1 << 3

GenRandSymbol .

View Source
const GenRandUpper = 1 << 1

GenRandUpper .

View Source
const GenRandUpperDigit = GenRandUpper | GenRandDigit

GenRandUpperDigit .

Variables

This section is empty.

Functions

func Coalesce

func Coalesce(strArgs ...string) string

Coalesce return first non empty argument

func Die

func Die(lastWord interface{})

Die prints "last word" and stop process

func DieIfError

func DieIfError(err error, message string)

DieIfError if error is not empty wrap it in message, print and stop process

func MustURLParse

func MustURLParse(urlStr string) *url.URL

MustURLParse helps to parse URL.

func MustValidate

func MustValidate(val interface{})

MustValidate helps to validate struct.

func RandString

func RandString(size int, set int, include string, exclude string) (string, error)

RandString .

func RandStringInit

func RandStringInit()

RandStringInit .

func RepeatMethod

func RepeatMethod(ctx context.Context, backoff BackoffFunc, maxAttempts int, callback func(context.Context) error) (err error)

RepeatMethod for max attempts and wait interval before them in sync mode

func WrapPanic

func WrapPanic(method func(ctx context.Context)) func(ctx context.Context) error

WrapPanic wraps any method for recovering after panic

Types

type BackoffFunc

type BackoffFunc func(ctx context.Context) error

BackoffFunc method

func BackoffEmpty

func BackoffEmpty() BackoffFunc

BackoffEmpty no waits

func BackoffExponential

func BackoffExponential(waitInterval time.Duration, multiply float64) BackoffFunc

BackoffExponential waits exponential time

func BackoffLinear

func BackoffLinear(waitInterval time.Duration) BackoffFunc

BackoffLinear waits linear time

Jump to

Keyboard shortcuts

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