general

package
v0.0.0-...-b990a46 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conditional

func Conditional[T any](cond bool, a, b T) T

Conditional is the tenary operator, BUT there is no conditional/lazy evaluation of the cases, because they are handled as arguments.

func ContainsForCompareFuncFor

func ContainsForCompareFuncFor[T any](a T, cmp CompareFunc[T]) func(b T) bool

func ContainsFuncFor

func ContainsFuncFor[E Equals[E]](a E) func(b E) bool

func Cycle

func Cycle[T comparable](id T, stack ...T) []T

func DescribeObject

func DescribeObject(o any) string

func EqualsForCompareFuncFor

func EqualsForCompareFuncFor[T any](cmp CompareFunc[T]) func(a, b T) bool

func EqualsFuncFor

func EqualsFuncFor[E Equals[E]]() func(a, b E) bool

func HashData

func HashData(d interface{}) string

func Must

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

Must expect a result to be provided without error.

func Optional

func Optional[T any](args ...T) T

func OptionalDefaulted

func OptionalDefaulted[T any](def T, args ...T) T

func OptionalDefaultedBool

func OptionalDefaultedBool(def bool, list ...bool) bool

OptionalDefaultedBool checks all args for true. If no args are given the given default is returned.

Types

type CompareFunc

type CompareFunc[E any] func(a, b E) int

type Equals

type Equals[T any] interface {
	Equals(a T) bool
}

Jump to

Keyboard shortcuts

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