Documentation ¶
Index ¶
- Variables
- func ApplyOptions[S any](s *S, oo ...Option[S]) *S
- func Coalesce[T comparable](tt ...T) T
- func Filter[T any](tt []T, match func(src T) bool) []T
- func Find[T any](tt []T, match func(src T) bool) *T
- func FindIndex[T any](tt []T, match func(src T) bool) int
- func Flat[T any](slices ...[]T) []T
- func FromAny[T any](src any) T
- func IndexOf[T comparable](expected T, tt []T) int
- func InsertIfNotExist[K comparable, V any](hm map[K]V, key K, value V)
- func Map[S, D any](ss []S, transformer Transformer[S, D]) []D
- func MatchEqual[T comparable](expected T) func(actual T) bool
- func PtrPtr[S, D any](src *S, transformer Transformer[S, D]) *D
- func PtrVal[T any](src *T) T
- func Reduce[T, R any](tt []T, reducer func(r R, t T) R) R
- func StringToRunes(src string) []rune
- func ToAny[T any](src T) any
- func ValPtr[T any](src T) *T
- type InPlaceOption
- type Option
- type OutOfPlaceOption
- type Transformer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateEntry = errors.New("duplicate entry")
Functions ¶
func ApplyOptions ¶
func IndexOf ¶
func IndexOf[T comparable](expected T, tt []T) int
func InsertIfNotExist ¶
func InsertIfNotExist[K comparable, V any](hm map[K]V, key K, value V)
func Map ¶
func Map[S, D any](ss []S, transformer Transformer[S, D]) []D
func MatchEqual ¶
func MatchEqual[T comparable](expected T) func(actual T) bool
func PtrPtr ¶
func PtrPtr[S, D any](src *S, transformer Transformer[S, D]) *D
PtrPtr transforms pointer of type S to pointer of type D. If src is nil it returns nil
func PtrVal ¶
func PtrVal[T any](src *T) T
PtrVal dereferences a pointer of type T. If it's nil it returns the zero value of T
func StringToRunes ¶
Types ¶
type InPlaceOption ¶
type InPlaceOption[S any] func(s *S)
func (InPlaceOption[S]) Apply ¶
func (o InPlaceOption[S]) Apply(s *S) *S
type OutOfPlaceOption ¶
type OutOfPlaceOption[S any] func(s S) S
type Transformer ¶
type Transformer[S, D any] func(src S) D
Source Files ¶
Click to show internal directories.
Click to hide internal directories.