util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(slice []string, val string) bool

Contains checks if a slice contains a specific string

func ConvertBytesToMB

func ConvertBytesToMB(bytes int64) int64

ConvertBytesToMB converts bytes to megabytes safely

func ConvertMBToBytes

func ConvertMBToBytes(mb int64) int64

ConvertMBToBytes converts megabytes to bytes safely

func DerefString

func DerefString(s *string) string

DerefString safely dereferences a string pointer, returning an empty string if the pointer is nil

func GetEnv

func GetEnv(key, defaultValue string) string

func GetIntEnv

func GetIntEnv(key string, defaultValue uint) (uint, error)

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the given int

func Must

func Must(err error)

func MustString

func MustString(fn StringerWithError) string

func ToStrPtr

func ToStrPtr(s string) *string

ToStrPtr returns a pointer to the given string

Types

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalJSON

func (duration *Duration) UnmarshalJSON(b []byte) error

type StringerWithError

type StringerWithError func() (string, error)

Jump to

Keyboard shortcuts

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