util

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T Number](a, b T) T

func Divide

func Divide[T Number](a, b T) T

func Fail

func Fail(msg any)

func FailOnError

func FailOnError(err error)

func Hash

func Hash(v string) string

func IsFinite

func IsFinite(v float64) bool

func IsInfinite

func IsInfinite(v float64) bool

func IsNaN

func IsNaN(v float64) bool

func Multiply

func Multiply[T Number](a, b T) T

func Must

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

func MustOK

func MustOK[T any](t T, ok bool) T

func NewDuration

func NewDuration[T Number](n T, d time.Duration) time.Duration

func NoError

func NoError[T any](_ T, err error) bool

func OK

func OK[T any](_ T, ok bool) bool

func Perm2

func Perm2[T any](v ...T) [][]T

func Subtract

func Subtract[T Number](a, b T) T

func TempDir

func TempDir(p ...string) string

func ToDegrees

func ToDegrees(radian float64) float64

func ToRadians

func ToRadians(degrees float64) float64

Types

type Comparable

type Comparable interface {
	cmp.Ordered
}

type CompareResult

type CompareResult int
const (
	CompareLess CompareResult = iota - 1
	CompareEqual
	CompareGreater
	CompareUnknown
)

func Compare

func Compare[T Comparable](a, b T) CompareResult

type Number

type Number interface {
	constraints.Float | constraints.Integer
}

Jump to

Keyboard shortcuts

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