tools

package
v0.0.0-...-a807e99 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Required = &requiredRule{message: "url cannot be blank", skipNil: false} // nolint:gochecknoglobals

Required is a ozzo-validation rule

Functions

func RetryIn

func RetryIn(interval time.Duration, call func() bool)

RetryIn retries passed function `call` until it end with success, else repeat again.

func RetryIncrementally

func RetryIncrementally(interval time.Duration, call func() bool)

RetryIncrementally retries passed function `call` until it end with success, else repeat again and increments retrying interval up to 2 hour.

func RetryIncrementallyUntil

func RetryIncrementallyUntil(interval time.Duration, until time.Duration, call func() bool) bool

RetryIncrementallyUntil retries passed function `call` until it end with success (returns true), else repeat again and increments retrying interval up to 2 hour until function `call` succeeded (returns true) or until `until` time reached (returns false).

Types

type URL

type URL struct {
	URL *url.URL
	Str string
	// contains filtered or unexported fields
}

URL is helper for configuration urls.

func (*URL) SetBasePath

func (j *URL) SetBasePath(path string)

SetBasePath add standard path-prefix for URL.

func (*URL) UnmarshalJSON

func (j *URL) UnmarshalJSON(data []byte) error

UnmarshalJSON is an implementation of json.Unmarshaler.

func (*URL) UnmarshalYAML

func (j *URL) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is an implementation of yaml.Unmarshaler.

func (URL) Validate

func (j URL) Validate() error

Validate is an implementation of Validatable interface from ozzo-validation.

func (*URL) WithPath

func (j *URL) WithPath(path string) string

WithPath returns formatted URL to string with given path-suffix.

func (*URL) WithPathURL

func (j *URL) WithPathURL(path string) url.URL

WithPath returns URL with sanitized and saved path-suffix.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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