convert

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package convert provides slice converation helpers

Index

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 Check

func Check[FS ~[]From, From, To any](elements FS, converter func(from From) (To, bool)) []To

Check - convert.Check is a short alias of slice.ConvertCheck

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 Indexed

func Indexed[FS ~[]From, From, To any](elements FS, by func(index int, from From) To) []To

Indexed - convert.Indexed is a short alias of slice.ConvertIndexed

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

func NotNil

func NotNil[FS ~[]*From, From, To any](elements FS, converter func(*From) To) []To

NotNil - convert.NotNil converts only not nil elements and returns them

func ToNotNil

func ToNotNil[FS ~[]From, From, To any](elements FS, converter func(From) *To) []*To

ToNotNil - convert.ToNotNil converts elements and returns only not nil converted elements

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL