to

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 2 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys[K comparable, V any](m map[K]V) []K

Keys returns a slice of keys from m map.

func Ptr

func Ptr[T any](value T) *T

func PtrOrNil

func PtrOrNil[T comparable](t T) *T

PtrOrNil returns a pointer to t if it has a non-empty value otherwise nil.

func SortedKeys

func SortedKeys[K cmp.Ordered, V any](m map[K]V) []K

SortedKeys returns a slice of keys from m map in sorted order (ascending).

func UniqueSlice

func UniqueSlice[T comparable](items []T) []T

UniqueSlice returns a slice without duplicate elements.

func UniqueSliceByKey

func UniqueSliceByKey[T any](items []T, getKey func(T) string) []T

UniqueSliceByKey returns a slice without duplicate elements using a custom get key function.

func ValueOrZero

func ValueOrZero[T any](ptr *T) T

ValueOrZero returns the value that the pointer ptr pointers to. It returns the zero value if ptr is nil.

func Values

func Values[K comparable, V any](m map[K]V) []V

Values returns a slice of values from m map.

Types

This section is empty.

Jump to

Keyboard shortcuts

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