Documentation
¶
Index ¶
- Variables
- func Conditional[T any](cond bool, trueExpr, falseExpr T) T
- func GetElem(o any) any
- func IsSameRawType(v1, v2 any) bool
- func IsSameType(v1, v2 any) bool
- func Max[T constraints.Ordered](v1, v2 T) T
- func Min[T constraints.Ordered](v1, v2 T) T
- func Pointer[T any](v T) *T
- func PointerMap[K comparable, V any](src map[K]V) map[K]*V
- func PointerSlice[T any](src []T) []*T
- func RawTypeOf(v any) string
- func Value[T any](v *T) T
- func ValueMap[K comparable, V any](src map[K]*V) map[K]V
- func ValueSlice[T any](src []*T) []T
- func ValueWithDefault[T any](val *T, defaultVal T) T
Constants ¶
This section is empty.
Variables ¶
var Version = "v0.1.0"
Functions ¶
func Conditional ¶
Conditional is an alternative to conditional (ternary) operator (?:).
func IsSameRawType ¶
IsSameRawType compares two values' type without pointer.
func Max ¶
func Max[T constraints.Ordered](v1, v2 T) T
Max returns the maximum value between v1 and v2.
func Min ¶
func Min[T constraints.Ordered](v1, v2 T) T
Min returns the minimum value between v1 and v2.
func PointerMap ¶
func PointerMap[K comparable, V any](src map[K]V) map[K]*V
PointerMap converts a map of values into a map of pointers.
func PointerSlice ¶
func PointerSlice[T any](src []T) []*T
PointerToSlice converts a slice of values into a slice of pointers.
func Value ¶
func Value[T any](v *T) T
Value returns the value of a pointer, or the zero value of the type if the pointer is nil.
func ValueMap ¶
func ValueMap[K comparable, V any](src map[K]*V) map[K]V
ValueMap converts a map of pointers into a map of values.
func ValueSlice ¶
func ValueSlice[T any](src []*T) []T
ValueSlice converts a slice of pointers into a slice of values.
func ValueWithDefault ¶
func ValueWithDefault[T any](val *T, defaultVal T) T
ValueWithDefault returns the value passed in if it is not nil, otherwise returns the default value.
Types ¶
This section is empty.