sliceutils

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v1.2.0

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