utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 7 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 HashInt64

func HashInt64(raw []byte) (int64, error)

func HashUInt32

func HashUInt32(raw []byte) (uint32, error)

func HashUInt64

func HashUInt64(raw []byte) (uint64, error)

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.6.0

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 SHA256

func SHA256(raw []byte) ([]byte, error)

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