Documentation
¶
Index ¶
- func IsFalse(value interface{}) bool
- func IsSliceType(v interface{}) bool
- func Max[T constraints.Ordered](a T, b T) T
- func Min[T constraints.Ordered](a T, b T) T
- func ObjsEqual(left interface{}, right interface{}) bool
- func Slice[T interface{} | rune](slice []T, parts []SliceParam) ([]T, error)
- func ToArrayArray(data interface{}) ([][]interface{}, bool)
- func ToArrayNum(data interface{}) ([]float64, bool)
- func ToArrayStr(data interface{}) ([]string, bool)
- func ToInteger(v interface{}) (int, bool)
- func ToPositiveInteger(v interface{}) (int, bool)
- type SliceParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFalse ¶
func IsFalse(value interface{}) bool
IsFalse determines if an object is false based on the JMESPath spec. JMESPath defines false values to be any of: - An empty string array, or hash. - The boolean value false. - nil.
func IsSliceType ¶
func IsSliceType(v interface{}) bool
func Max ¶
func Max[T constraints.Ordered](a T, b T) T
func Min ¶
func Min[T constraints.Ordered](a T, b T) T
func ObjsEqual ¶
func ObjsEqual(left interface{}, right interface{}) bool
ObjsEqual is a generic object equality check. It will take two arbitrary objects and recursively determine if they are equal.
func Slice ¶
func Slice[T interface{} | rune](slice []T, parts []SliceParam) ([]T, error)
Slice supports [start:stop:step] style slicing that's supported in JMESPath.
func ToArrayArray ¶
func ToArrayArray(data interface{}) ([][]interface{}, bool)
ToArrayArray converts an empty interface type to a slice of slices. If any element in the array cannot be converted, then nil is returned along with a second value of false.
func ToArrayNum ¶
ToArrayNum converts an empty interface type to a slice of float64. If any element in the array cannot be converted, then nil is returned along with a second value of false.
func ToArrayStr ¶
ToArrayStr converts an empty interface type to a slice of strings. If any element in the array cannot be converted, then nil is returned along with a second value of false. If the input data could be entirely converted, then the converted data, along with a second value of true, will be returned.
func ToInteger ¶
ToInteger converts an empty interface to a integer. It expects the empty interface to represent a float64 JSON number. If the empty interface cannot be converted or if the number is not an integer, the function returns a second boolean value false.
func ToPositiveInteger ¶
Types ¶
type SliceParam ¶
SliceParam refers to a single part of a slice. A slice consists of a start, a stop, and a step, similar to python slices.
func MakeSliceParams ¶
func MakeSliceParams(parts []*int) []SliceParam