util

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

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Heartbeat

func Heartbeat(ctx context.Context, interval Duration, handler func())

Heartbeat starts a goroutine that calls handler every interval and stops on ctx.Done(). If interval is not higher than 0 the function does nothing

Types

type Duration

type Duration struct {
	time.Duration
}

Duration represents time.Duration with JSON Marshall/Unmarshal methods

func (Duration) MarshalJSON

func (t Duration) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Duration to JSON data

func (*Duration) UnmarshalJSON

func (t *Duration) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON unmarshals the JSON data to Duration

Jump to

Keyboard shortcuts

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