Documentation
¶
Index ¶
- func Equal[C comparable](v C, values ...C) bool
- func HashStruct(v any) (string, error)
- func IsMap(v interface{}) bool
- func IsSlice(v interface{}) bool
- func NilAllExceptByTag(v interface{}, jsonTags []string)
- func ReflectIntersect(a, b any) any
- func ReflectIsSubsetOf(is, of any) bool
- func ReflectIsSupersetOf(is, of any) bool
- func ReflectSliceCast(slice, newType any) any
- func ReflectSliceContains(v, slice any) bool
- func ReflectUnion(a, b any) any
- func SliceEqual(a, b interface{}) bool
- func Slicify(in any) any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal[C comparable](v C, values ...C) bool
Equal compares multiple comparable values for equality
func HashStruct ¶ added in v0.8.0
HashStruct hashes a struct using msgpack and SHA3-256.
func IsMap ¶
func IsMap(v interface{}) bool
IsMap uses reflection to check if an interface{} is a map
func IsSlice ¶
func IsSlice(v interface{}) bool
IsSlice uses reflection to check if an interface{} is a slice
func NilAllExceptByTag ¶
func NilAllExceptByTag(v interface{}, jsonTags []string)
NilAllExceptByTag sets all fields of a struct to their zero values except for the fields with the specified JSON tags.
func ReflectIntersect ¶
ReflectIntersect uses reflection to compute the intersection of two slices
func ReflectIsSubsetOf ¶
ReflectIsSubsetOf uses reflection to check if a slice is a subset of another
func ReflectIsSupersetOf ¶
ReflectIsSupersetOf uses reflection to check if a slice is a superset of another
func ReflectSliceCast ¶
ReflectSliceCast converts a slice to another type using reflection. Parameters:
- slice: source slice to convert
- newType: target type for the slice elements
Retur Returns:
- converted slice or original value if input is not a slice
func ReflectSliceContains ¶
ReflectSliceContains checks if a slice contains a value using reflection
func ReflectUnion ¶
ReflectUnion uses reflection to compute the union of two slices
func SliceEqual ¶
func SliceEqual(a, b interface{}) bool
SliceEqual uses reflection to check if two slices contain the same elements; order does not matter, assumes no duplicate entries in a slice
Types ¶
This section is empty.