Documentation ¶
Overview ¶
Package zarray provides array operations
Index ¶
- Variables
- func Filter[T any](slice []T, predicate func(index int, item T) bool) []T
- func GetInf(arr []interface{}, index int, def ...interface{}) (value interface{}, err error)
- func Shuffle[T any](collection []T) []T
- type Array
- func (arr *Array) Add(index int, value interface{}) (err error)
- func (arr *Array) CapLength() int
- func (arr *Array) Clear()
- func (arr *Array) Contains(value interface{}) bool
- func (arr *Array) Format() (format string)
- func (arr *Array) Get(index int, def ...interface{}) (value interface{}, err error)
- func (arr *Array) Index(value interface{}) int
- func (arr *Array) IsEmpty() bool
- func (arr *Array) Length() int
- func (arr *Array) Map(fn func(int, interface{}) interface{}) *Array
- func (arr *Array) Pop() (interface{}, error)
- func (arr *Array) Push(values ...interface{})
- func (arr *Array) Raw() []interface{}
- func (arr *Array) Remove(index int, l ...int) (value []interface{}, err error)
- func (arr *Array) RemoveValue(value interface{}) (e interface{}, err error)
- func (arr *Array) Set(index int, value interface{}) (err error)
- func (arr *Array) Shift() (interface{}, error)
- func (arr *Array) Shuffle() (array *Array)
- func (arr *Array) Unshift(value interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIllegalIndex = errors.New("illegal index")
ErrIllegalIndex illegal index
Functions ¶
func Filter ¶ added in v1.3.6
Filter iterates over elements of collection, returning an array of all elements predicate returns truthy for
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array insert, delete, random access according to the subscript operation, the data is interface type
func (*Array) Push ¶
func (arr *Array) Push(values ...interface{})
Push insert element to end of array
func (*Array) RemoveValue ¶
RemoveValue removes the specified element from the array
Click to show internal directories.
Click to hide internal directories.