Documentation ¶
Overview ¶
Package convert provides slice converation helpers
Index ¶
- func AndConvert[FS ~[]From, From, I, To any](elements FS, firsConverter func(From) I, secondConverter func(I) To) []To
- func AndFilter[FS ~[]From, From, To any](elements FS, converter func(From) To, filter func(To) bool) []To
- func AndReduce[FS ~[]From, From, To any](elements FS, converter func(From) To, merge func(To, To) To) (out To)
- func Check[FS ~[]From, From, To any](elements FS, converter func(from From) (To, bool)) []To
- func CheckIndexed[FS ~[]From, From, To any](elements FS, by func(index int, from From) (To, bool)) []To
- func Indexed[FS ~[]From, From, To any](elements FS, by func(index int, from From) To) []To
- func NilSafe[FS ~[]*From, From, To any](elements FS, converter func(*From) *To) []*To
- func NotNil[FS ~[]*From, From, To any](elements FS, converter func(*From) To) []To
- func ToNotNil[FS ~[]From, From, To any](elements FS, converter func(From) *To) []*To
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AndConvert ¶
func AndConvert[FS ~[]From, From, I, To any](elements FS, firsConverter func(From) I, secondConverter func(I) To) []To
AndConvert - convert.AndConvert makes double converts From->Intermediate->To of the elements
func AndFilter ¶
func AndFilter[FS ~[]From, From, To any](elements FS, converter func(From) To, filter func(To) bool) []To
AndFilter - convert.AndFilter converts only filtered elements and returns them
func AndReduce ¶ added in v0.0.8
func AndReduce[FS ~[]From, From, To any](elements FS, converter func(From) To, merge func(To, To) To) (out To)
AndReduce - convert.AndReduce converts elements and merge them into one
func CheckIndexed ¶
func CheckIndexed[FS ~[]From, From, To any](elements FS, by func(index int, from From) (To, bool)) []To
CheckIndexed - convert.CheckIndexed is a short alias of slice.ConvertCheckIndexed
func NilSafe ¶
func NilSafe[FS ~[]*From, From, To any](elements FS, converter func(*From) *To) []*To
NilSafe - convert.NilSafe filters not nil elements, converts that ones, filters not nils after converting and returns them
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.