ds

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ds provides some utilities relating to data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlatMap

func FlatMap[T any, R any, ST ~[]T, SR ~[]R](arr ST, iteratee func(T) SR) SR

func FlatMapError

func FlatMapError[T any, R any, ST ~[]T, SR ~[]R](arr ST, iteratee func(T) (SR, error)) (SR, error)

func Limit

func Limit[T any, ST ~[]T](arr ST, limit int) ST

Limit limits array to given limit length, if the slice is larger than the given limit.

func Map

func Map[T any, R any, ST ~[]T](arr ST, iteratee func(T) R) []R

func MapError

func MapError[T any, R any, ST ~[]T](arr ST, iteratee func(T) (R, error)) ([]R, error)

func SortAsc

func SortAsc[E any, K constraints.Ordered](key func(e E) K) func(e1, e2 E) int

func SortCompose

func SortCompose[E any](comparators ...func(e1, e2 E) int) func(e1, e2 E) int

func SortDesc

func SortDesc[E any, K constraints.Ordered](key func(e E) K) func(e1, e2 E) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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