slice

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToSnake

func CamelToSnake(ss []string) []string

CamelToSnake change array string to snaker

func Chunk

func Chunk(slice interface{}, chunkSize int) interface{}

Chunk defined

func GetFieldSliceByName

func GetFieldSliceByName(arr interface{}, name string, format ...string) interface{}

GetFieldSliceByName defined

func IsIteratee

func IsIteratee(in interface{}) bool

IsIteratee returns if the argument is an iteratee.

func PatchSliceByField

func PatchSliceByField(target interface{}, source interface{}, targetMatchKey string, sourceMatchKey string, key ...string) ([]map[string]interface{}, error)

PatchSliceByField defined

func RemoveStringDuplicates

func RemoveStringDuplicates(s []string) ([]string, []string)

RemoveStringDuplicates defined

func StrSliceContains

func StrSliceContains(ss []string, s string) bool

StrSliceContains check string exists in array

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice defined

Types

type SyncSlice

type SyncSlice struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SyncSlice type that can be safely shared between goroutines

func (*SyncSlice) Append

func (cs *SyncSlice) Append(item interface{})

Append pends an item to the concurrent slice

func (*SyncSlice) Clear

func (cs *SyncSlice) Clear()

Clear an item to the concurrent slice

func (*SyncSlice) Iter

func (cs *SyncSlice) Iter() <-chan SyncSliceItem

Iter over the items in the concurrent slice Each item is sent over a channel, so that we can iterate over the slice using the builin range keyword

func (*SyncSlice) Reset

func (cs *SyncSlice) Reset() []interface{}

Reset slice item to the concurrent slice

func (*SyncSlice) Values

func (cs *SyncSlice) Values() []interface{}

Values an item to the concurrent slice

type SyncSliceItem

type SyncSliceItem struct {
	Index int
	Value interface{}
}

SyncSliceItem slice item

Jump to

Keyboard shortcuts

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