utils

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const EnvAmHostname = "AM_HOSTNAME"

EnvAmHostname will override the hostname in all machine names.

Variables

This section is empty.

Functions

func CaptureStackTrace added in v0.17.0

func CaptureStackTrace() string

func CloseSafe added in v0.10.1

func CloseSafe[T any](ch chan T)

TODO remove if that speeds things up

func GetVersion

func GetVersion() string

func Hostname

func Hostname() string

func J

func J(states []string) string

J joins state names into a single string

func Jw

func Jw(states []string, sep string) string

Jw joins state names into a single string with a separator.

func P added in v0.10.2

func P(txt string, args ...any)

func PadString added in v0.17.0

func PadString(str string, length int, pad string) string

func RandId added in v0.10.1

func RandId(strLen int) string

RandId generates a random ID of the given length (defaults to 8).

func SlicesEvery added in v0.10.1

func SlicesEvery[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool

SlicesEvery returns true if all elements of coll2 are in coll1.

func SlicesNone added in v0.10.1

func SlicesNone[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool

SlicesNone returns true if none of the elements of coll2 are in coll1.

func SlicesUniq added in v0.10.1

func SlicesUniq[S ~[]E, E comparable](coll S) S

func SlicesWithout added in v0.10.1

func SlicesWithout[S ~[]E, E comparable](coll S, el E) S

func Sp added in v0.10.2

func Sp(txt string, args ...any) string

func StructFields added in v0.17.1

func StructFields(input interface{}) ([]string, error)

func TruncateStr added in v0.17.0

func TruncateStr(s string, maxLength int) string

TruncateStr with shorten the string and leave a tripedot suffix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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