util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotate

func Annotate(err error, format string, args ...any) error

Annotate provides an additional context for the error.

func Fail

func Fail(err error, format string, args ...any)

A Fail prints the error message and then exits the program.

func GenString

func GenString(n int) string

GenString generates a random string with length n

func Random

func Random(min int, max int) int

Random generates a random number within a specified range.

func Sleep

func Sleep(n int)

Sleep pauses the execution of the program. Interval is generated randomly with the upper bound limit provided by you.

func ValidateStr

func ValidateStr(key string, keys []string)

ValidateStr checks if the string is allowed. Example:

ValidateStr("redis", []string{"redis", "memcached"}

func Warn

func Warn(err error, format string, args ...any)

A Warn notifies you that something has gone wrong with the execution of the program.

Types

This section is empty.

Jump to

Keyboard shortcuts

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