slice

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk

func Chunk[T any](slice []T, chunkSize int) [][]T

Chunk helps chunk a slice into equal size

Types

type LockFree added in v2.8.2

type LockFree[T any] struct {
	// contains filtered or unexported fields
}

LockFree type that can be safely shared between goroutines.

func NewLockFree added in v2.8.2

func NewLockFree[T any]() *LockFree[T]

NewLockFree creates a new lock-free thread-safe slice.

func (*LockFree[T]) Append added in v2.8.2

func (cs *LockFree[T]) Append(item T)

Append adds an item to the concurrent slice.

func (*LockFree[T]) Delete added in v2.8.2

func (cs *LockFree[T]) Delete(index int)

Delete an item from the slice

func (*LockFree[T]) Get added in v2.8.2

func (cs *LockFree[T]) Get(index int) (item T)

Get returns the slice item at the given index

func (*LockFree[T]) Items added in v2.8.2

func (cs *LockFree[T]) Items() []T

Items returns the list of items

func (*LockFree[T]) Len added in v2.8.2

func (cs *LockFree[T]) Len() int

Len returns the number of items

func (*LockFree[T]) Reset added in v2.8.2

func (cs *LockFree[T]) Reset()

Reset resets the slice

Jump to

Keyboard shortcuts

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