util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(attempt int, max time.Duration) time.Duration

func FormatTime

func FormatTime(t time.Time) string

func GetIDByAddr

func GetIDByAddr(addr string) string

func GetJSONValue

func GetJSONValue(data interface{}, path string) (interface{}, error)

func GetLocalIP

func GetLocalIP() string

func GetTimeLayout

func GetTimeLayout() string

func IsSpace

func IsSpace(c byte) bool

func IsValidIPV4Address

func IsValidIPV4Address(str string) bool

func MapLen

func MapLen(m *sync.Map) int

func ParseJSON

func ParseJSON(b []byte) (interface{}, error)

func ParseTime

func ParseTime(str string) (time.Time, error)

func RandomString

func RandomString(length int) (string, error)

func SleepWithContext

func SleepWithContext(ctx context.Context, duration time.Duration) bool

func UntilWithContext

func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration)

func ValidateEventAttrName

func ValidateEventAttrName(attr string) error

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (*Group) Start

func (g *Group) Start(f func())

Start starts f in a new goroutine in the group.

func (*Group) StartWithChannel

func (g *Group) StartWithChannel(stopCh <-chan struct{}, f func(stopCh <-chan struct{}))

StartWithChannel starts f in a new goroutine in the group. stopCh is passed to f as an argument. f should stop when stopCh is available.

func (*Group) StartWithContext

func (g *Group) StartWithContext(ctx context.Context, f func(context.Context))

StartWithContext starts f in a new goroutine in the group. ctx is passed to f as an argument. f should stop when ctx.Done() is available.

func (*Group) Wait

func (g *Group) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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