util

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelCase added in v0.2.0

func CamelCase(str string) string

func Coalesce

func Coalesce[T stringish](vals ...T) T

Returns the first non nil and non empty string

func CoalescePointers

func CoalescePointers[T any](vals ...*T) *T

Returns the first non nil value

func CoalesceStrings

func CoalesceStrings(strs ...string) string

Returns the first non-empty string

func CoalesceWithFunc

func CoalesceWithFunc[T any](checkFunc func(T) bool, values ...T) (T, bool)

Returns the first non-nil element that the provided function returns true for

func FirstParam

func FirstParam[T any, U any](fp T, _ ...U) T

returns the first value of a multi-return statement

func IsAlphaNumeric added in v0.2.0

func IsAlphaNumeric(r rune) bool

func Must

func Must[T any](v T, err error) T

Return or panic

func SnakeCase added in v0.2.0

func SnakeCase(str string) string

func Ternary

func Ternary[T any](expr bool, trueVal T, falseVal T) T

Bring back one liner ternary

bool ? trueVal : falseVal

Types

This section is empty.

Jump to

Keyboard shortcuts

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