slice_utils

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 2 Imported by: 0

README

Slice Utils

some Utils for Go Slices.

Support

If you find this project useful, you can support its development by buying me a coffee:

Buy Me A Coffee

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate[T any, R any](slice []T, aggregator func(int, T, R) R, initial R) R

Aggregate iterates over a slice and applies an aggregator function to each element.

func Chunk

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

Chunk splits a slice into chunks of the specified size.

func Convert

func Convert[T any, R any](slice []T, converter func(T) R) []R

Convert converts a slice of type T to a slice of type R

func Filter

func Filter[T any](s []T, filter func(T) bool) []T

func First

func First[T any](s []T, filter func(item T) bool) (T, fail.CustomError)

func ToAnyArray

func ToAnyArray[T any](slice []T) []any

ToAnyArray converts a slice to an array of any

func ToStringArray

func ToStringArray[T any](slice []T) []string

ToStringArray converts a slice to a string array

Types

This section is empty.

Jump to

Keyboard shortcuts

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