util

package
v0.0.0-...-9a8ef1a Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimerCancel = errors.New("timer canceled")
)

Functions

func FieldByTag

func FieldByTag(ref reflect.Value, tag string, tagValue string) reflect.Value

func FirstLine

func FirstLine(str string) string

Returns the first line of a string.

func Hash

func Hash(v interface{}) string

Hashes the given argument.

func IsUpper

func IsUpper(b byte) bool

Checks if a letter is uppercase

func MaskCredentials

func MaskCredentials(url string) string

Masks all creadentials in an url

func MinInt

func MinInt(a, b int) int

Gets the minimum of two integers.

func ShortHash

func ShortHash(hash string) string

Returns the short hash of a longer one.

func StrEmpty

func StrEmpty(strs ...string) bool

Returns true if all strings are empty.

func StrFilter

func StrFilter(str string, blacklist map[string]string) string

Replaces all occurencies of blacklist keys in str with the map value.

Types

type CycleTimer

type CycleTimer struct {
	StartTime time.Time
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(cycleTime time.Duration, fn func(t *CycleTimer), done func()) *CycleTimer

func (*CycleTimer) Cancel

func (t *CycleTimer) Cancel()

Canceling the waiting of a cycle.

func (*CycleTimer) Start

func (t *CycleTimer) Start()

func (*CycleTimer) Wait

func (t *CycleTimer) Wait(duration time.Duration) error

Wait for the given amount of time.

Jump to

Keyboard shortcuts

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