utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorDarkGray = 90
)

Variables

This section is empty.

Functions

func Colorize added in v0.7.0

func Colorize(s interface{}, c int) string

func DefaultIfZero

func DefaultIfZero[T any](v T, fallback T) T

func DurationS

func DurationS(seconds int64) time.Duration

func HeaderMap

func HeaderMap(header http.Header) map[string]string

func IsValidUUID

func IsValidUUID(id string) bool

func KSUID

func KSUID() string

func MapToStruct added in v0.8.0

func MapToStruct(data map[string]interface{}, v interface{}) error

func MergeMap added in v0.8.0

func MergeMap(dst, src map[string]interface{})

func Must

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

func Pointer

func Pointer[T any](v T) *T

func PointerValue

func PointerValue[T any](v *T) T

func RandomString added in v0.2.0

func RandomString(n int) string

func RegisterFormatter added in v0.7.0

func RegisterFormatter(tag string, fn func(fe validator.FieldError) string)

func RegisterValidation added in v0.7.0

func RegisterValidation(tag string, fn validator.Func)

func StructToMap added in v0.8.0

func StructToMap(v interface{}) (map[string]interface{}, error)

func UUID

func UUID() string

func UUIDShort

func UUIDShort() string

func Validate

func Validate(v interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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