commonutil

package
v0.0.0-...-1fe6fdb Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsSameAndNoDuplicates

func ContainsSameAndNoDuplicates[T comparable](a, b []T) bool

func FormatInt

func FormatInt(v int) string

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

generateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomStringAlphabet

func GenerateRandomStringAlphabet(n int, letters string) (string, error)

func GenerateRandomStringURLSafe

func GenerateRandomStringURLSafe(n int) (string, error)

GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func HasDuplicates

func HasDuplicates[T comparable](a []T) bool

func MapSlice

func MapSlice[T, U any](ts []T, f func(T) U) []U

func MergeArrays

func MergeArrays[T cmp.Ordered](a, b []T) []T

func MergeArraysNoSort

func MergeArraysNoSort[T comparable](a, b []T) []T

func ParseStringArrayToUUID

func ParseStringArrayToUUID(ids []string) []uuid.UUID

func RandomInt32

func RandomInt32() int32

func RandomPositiveInt32

func RandomPositiveInt32() int32

func RandomUint32

func RandomUint32() uint32

func StringifyUUIDArray

func StringifyUUIDArray(uuids []uuid.UUID) []string

func URLParamInt64 deprecated

func URLParamInt64(r *http.Request, name string) (int64, error)

Deprecated: don't use

Types

This section is empty.

Jump to

Keyboard shortcuts

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