utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 4 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseMute

func CloseMute(closer Closer)

func DefaultInt

func DefaultInt(a interface{}, b int) int

func DefaultString

func DefaultString(a interface{}, b string) string

func DefaultZero

func DefaultZero[A any](v interface{}) A

func ExponentialBucketTimeRange

func ExponentialBucketTimeRange(start, end time.Duration, buckets int) []float64

ExponentialBucketTimeRange creates a bucket set for a histogram that has exponentially increasing intervals between the values, e.g. 0, 0.5, 1, 2, 4, 8, ...

func IgnoreError

func IgnoreError(err error)

func IgnoreErrorFunc

func IgnoreErrorFunc(f func() error)

func IgnoreErrorWithOneArg added in v0.4.1

func IgnoreErrorWithOneArg[T any](fn func(t T) error, t T)

func IsNil added in v0.5.1

func IsNil[T any](value T) bool

func LinearBucketRange

func LinearBucketRange(start, end int64, buckets int) []float64

LinearBucketRange creates a bucket set for a histogram that has uniform intervals between the values, e.g. 0, 1, 2, 3, 4, ...

func LinearBucketTimeRange

func LinearBucketTimeRange(start, end time.Duration, buckets int) []float64

LinearBucketTimeRange creates a bucket set for a histogram that has uniform intervals between the values, e.g. 0, 1, 2, 3, 4, ...

func Must

func Must(err error)

func MustGet

func MustGet[V any](v V, err error) V

func Zero

func Zero[A any]() A

Types

type Closer

type Closer interface {
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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