Documentation
¶
Index ¶
- func Equal[C comparable](v C, values ...C) bool
- func HashStruct(v any) (string, error)
- func IsMap(v any) bool
- func IsSlice(v any) bool
- func NilAllExceptByTag(v any, jsonTags []string)
- func ReflectDifference(a, b any) any
- func ReflectDisjoint(a, b any) bool
- 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 any) 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 NilAllExceptByTag ¶
NilAllExceptByTag sets all fields of a struct to their zero values except for the fields with the specified JSON tags.
func ReflectDifference ¶ added in v0.11.0
ReflectDifference uses reflection to compute the set difference of two slices: the elements of a that are not contained in b, preserving the order of a.
func ReflectDisjoint ¶ added in v0.11.0
ReflectDisjoint uses reflection to check if two slices have no elements in common
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 ¶
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.