utils

package
v0.30.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToFloat

func BoolToFloat(b bool) float64

func MBToBytes

func MBToBytes(mb float64) float64

func MilliSecToSec

func MilliSecToSec(t float64) float64

func Must

func Must[T any](v T, err error) T

Must panics if the error is not nil.

func PercentageToRatio

func PercentageToRatio(percentage float64) float64

func SplitError

func SplitError(err error) []error

SplitError returns a slice of errors from the given error. It reverses the errors.Join function.

func ToPTR

func ToPTR[t any](v t) *t

Types

type Counter

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

func NewCounter

func NewCounter(lastValue uint32) Counter

NewCounter creates a new Counter that accepts uint32 values and returns float64 values. It resolve the overflow issue of uint32 by using the difference between the last value and the current value.

func (*Counter) AddValue

func (c *Counter) AddValue(value uint32)

func (*Counter) Value

func (c *Counter) Value() float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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