Documentation ¶
Index ¶
- func AddKeysToMap[T comparable](m map[T]any, items ...T)
- func Apply[T any, K any](items []T, f func(in T) K) []K
- func ChainErr(err1 error, err2 error) error
- func Filter[T any](records []T, predicate func(item T) bool) (ret []T)
- func Keys[K comparable, V any](m map[K]V) []K
- func MaxInt(a, b int) int
- func MaxUInt32(a, b uint32) uint32
- func MergeInto[T comparable, V any](m1 map[T]V, m2 map[T]V)
- func MinInt(a, b int) int
- func MinUInt32(a, b uint32) uint32
- func Must[T any](obj T, err error) T
- func ReadCsvFile(filePath string) ([][]string, error)
- func SplitNoEmpty(s string, sep string) []string
- func ToMap[T comparable](items ...T) map[T]any
- func Values[K comparable, V any](m map[K]V) []V
- type CompSet
- type Context
- type Group
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddKeysToMap ¶
func AddKeysToMap[T comparable](m map[T]any, items ...T)
func ChainErr ¶
TODO - there should be some build in mechanism for this. E.g. there is errros.Unwrap. Can we use that without this method?
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
func MergeInto ¶
func MergeInto[T comparable, V any](m1 map[T]V, m2 map[T]V)
func ReadCsvFile ¶
func SplitNoEmpty ¶
func ToMap ¶
func ToMap[T comparable](items ...T) map[T]any
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Types ¶
type CompSet ¶
type CompSet[T comparable] struct { // contains filtered or unexported fields }
func NewCompSet ¶
func NewCompSet[T comparable](items ...T) CompSet[T]
NewCompSet initializes a new set
func (CompSet[T]) Add ¶
func (set CompSet[T]) Add(items ...T)
Add adds the items one or more to the set.
func (CompSet[T]) Contains ¶
Contains returns true if the item is contained in the set. Equality is determined using the hashCode() and equals() functions.
func (CompSet[T]) Items ¶
func (set CompSet[T]) Items() (res []T)
Items returns the all items in the set in a slice
func (CompSet[T]) MarshalJSON ¶
MarshalJSON converts the set to an array-like json representation
func (*CompSet[T]) UnmarshalJSON ¶
UnmarshalJSON initializes a set from an array-like json representation
type Context ¶
func Background ¶
func Background() Context
func WithCancel ¶
func WithCancel(parent Context) (Context, context.CancelFunc)
func WithTimeout ¶
Click to show internal directories.
Click to hide internal directories.