Documentation
¶
Overview ¶
Package util provides miscellaneous utility functions used across the argo-go library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPathIndex ¶
AddPathIndex appends an integer index to an ast.Path.
func AddPathName ¶
AddPathName appends a string name to an ast.Path.
func FormatPath ¶
func GroupBy ¶
func GroupBy[T any, K comparable](array []T, extract func(T) K) map[K][]T
GroupBy groups elements of a slice into a map based on a key extracted from each element.
Types ¶
type OrderedMapJSON ¶
type OrderedMapJSON[K comparable, V any] struct { *orderedmap.OrderedMap[K, V] }
OrderedMapJSON is a wrapper around orderedmap.OrderedMap to allow custom JSON marshalling. It needs to be generic to match the orderedmap.OrderedMap it wraps.
func NewOrderedMapJSON ¶
func NewOrderedMapJSON[K comparable, V any](om *orderedmap.OrderedMap[K, V]) *OrderedMapJSON[K, V]
NewOrderedMapJSON creates a new OrderedMapJSON wrapper.
func (OrderedMapJSON[K, V]) MarshalJSON ¶
func (omj OrderedMapJSON[K, V]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface. This method will be called by json.Marshal and json.MarshalIndent.
func (OrderedMapJSON[K, V]) MustMarshalJSON ¶
func (omj OrderedMapJSON[K, V]) MustMarshalJSON() []byte
MustMarshalJSON calls MarshalJSON and panics if an error occurs.