util

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayCast

func ArrayCast[T any](source []interface{}) []T

func ArrayConvert

func ArrayConvert[T any, Y any](source []Y,
	convert func(item Y) T) []T

func ArrayFilter

func ArrayFilter[T any](source []T, filter func(item T) bool) []T

func Average

func Average(source []float64) float64

func If

func If[T any](cond bool, vtrue, vfalse T) T

func Max

func Max(source []float64) float64

func Random

func Random(max, min int) int

func RandomID

func RandomID(name string) string

func RandomItemFromArray

func RandomItemFromArray[X any](source []X) X

func SplitSlice

func SplitSlice[T any, Y comparable](source []T,
	identification func(item T) Y) (m map[Y][]T)

This function split a list based on a evaluation function the result is a map of lists

func SplitString

func SplitString(source, delimiter string) []string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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