slices

package
v0.0.0-...-d80f745 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchAsyncExec

func BatchAsyncExec[T any](wg *sync.WaitGroup, list []T, batchsize int, f func(start, end int) error) error

分段异步处理 每次处理batchsize的数量

func BatchExec

func BatchExec[T any](list []T, batchsize int, f func(start, end int) error) error

分段处理 每次返回batchsize数量 同步处理

func BufAppend

func BufAppend[S ~string | ~[]byte](buf *[]byte, s S)

func Concat

func Concat[T any](a, b []T) []T

拼接两个slice

比如 [1,2,3] + [2,3,4] -> [1,2,3,2,3,4]

func ConcatUniq

func ConcatUniq[T comparable](a, b []T) []T

拼接两个slice后去重

比如 [1,2,3] + [2,3,4] -> [1,2,3,4]

func JoinInts

func JoinInts[T generics.Integer](ints []T) string

将整数slice通过','组合在一起返回一个string

比如 [1,2,3,4,5] -> "1,2,3,4,5"

func JoinStrings

func JoinStrings(strs []string) string

将字符串slice通过','组合在一起返回一个string

func Uniq

func Uniq[T comparable](v []T) []T

slice去重

比如 [1,2,2,3,4] -> [1,2,3,4]

Types

This section is empty.

Jump to

Keyboard shortcuts

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