util

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Schedule added in v0.3.1

func Schedule(action func() error, interval time.Duration, errorMessage string)

Schedule runs the specified `action` periodically.

func ScheduleNow added in v0.3.1

func ScheduleNow(action func() error, interval time.Duration, errorMessage string)

ScheduleNow runs the specified `action` immediately and periodically.

func WaitUntil added in v0.4.0

func WaitUntil(fn func() error, timeout time.Duration) error

WaitUntil runs the given function within a time duration

Types

type Reminder

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

Reminder is used for time consuming operations to remind user about progress.

func NewReminder

func NewReminder(logger *logrus.Logger, interval time.Duration) *Reminder

NewReminder returns a new Reminder instance.

`level`: log level to remind in general.

`interval`: interval to remind in warning level.

func (*Reminder) Remind

func (reminder *Reminder) Remind(message string, fields ...logrus.Fields)

Remind reminds about specified `message` and optional `fields`.

func (*Reminder) RemindWith

func (reminder *Reminder) RemindWith(message string, key string, value interface{})

RemindWith reminds about specified `message` along with `key` and `value`.

Jump to

Keyboard shortcuts

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