sliceutils

package
v2.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(src []interface{}, test interface{}) bool

Contains asserts src contains test

func ContainsDeep

func ContainsDeep(src []interface{}, test interface{}) bool

ContainsDeep asserts src contains test using reflect.DeepEqual

func ConvertAny2Interface

func ConvertAny2Interface(src interface{}) ([]interface{}, error)

ConvertAny2Interface converts interface src to interface slice

func IndexOf

func IndexOf(element string, data []string) int

IndexOf returns index of element in string slice data

func IndexOfAny

func IndexOfAny(target interface{}, anySlice interface{}) (int, error)

IndexOfAny returns index of element in slice data

func InterfaceSlice2StringSlice

func InterfaceSlice2StringSlice(strSlice []interface{}) []string

InterfaceSlice2StringSlice converts interface slice to string slice

func IsEmpty

func IsEmpty(src interface{}) bool

IsEmpty assert src is an empty slice

func StringContains

func StringContains(src []string, test string) bool

StringContains asserts src contains test

func StringFilter

func StringFilter(src []string, fn func(item string) bool) []string

StringFilter filters string slice by callback function fn If fn returns true, the item will be appended to result

func StringSlice2InterfaceSlice

func StringSlice2InterfaceSlice(strSlice []string) []interface{}

StringSlice2InterfaceSlice converts string slice to interface slice

func TakeSliceArg

func TakeSliceArg(arg interface{}) (out []interface{}, ok bool)

TakeSliceArg https://ahmet.im/blog/golang-take-slices-of-any-type-as-input-parameter/

Types

This section is empty.

Jump to

Keyboard shortcuts

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