utils

package
v0.0.0-...-e486d47 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: GPL-3.0 Imports: 7 Imported by: 1 module, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallOnce

func CallOnce(f func()) func()

CallOnce function decorator returns new function which can be called only once and is thread safe

func HardKiller

func HardKiller(kill Killer) func()

HardKiller invokes provided kill method and forces process to exit

func SoftKiller

func SoftKiller(kill Killer) func()

SoftKiller invokes killer and gives a chance for process to cleanup itself

Types

type ErrorCollection

type ErrorCollection []error

ErrorCollection knows how to combine multiple error strings

func (*ErrorCollection) Add

func (ec *ErrorCollection) Add(errors ...error)

Add puts given error to collection

func (*ErrorCollection) Error

func (ec *ErrorCollection) Error() error

Error converts collection to single error

func (*ErrorCollection) Errorf

func (ec *ErrorCollection) Errorf(format, errorDelimiter string) error

Errorf converts collection to single error by wanted format

func (*ErrorCollection) String

func (ec *ErrorCollection) String() string

String concatenates collection to single string

func (*ErrorCollection) Stringf

func (ec *ErrorCollection) Stringf(format, errorDelimiter string) string

Stringf returns a string representation of the underlying errors with the given format

type Killer

type Killer func() error

Killer kills some resource and performs cleanup

type SettableClock

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

SettableClock allows settings and getting time, which is convenient for testing

func (*SettableClock) AddTime

func (clock *SettableClock) AddTime(duration time.Duration)

AddTime adds given duration to current clock time

func (*SettableClock) GetTime

func (clock *SettableClock) GetTime() time.Time

GetTime returns set time

func (*SettableClock) SetTime

func (clock *SettableClock) SetTime(time time.Time)

SetTime sets time to be returned from GetTime

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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