util

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gen16CharID

func Gen16CharID() string

func Gen32CharID

func Gen32CharID() string

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func GetErrorCode

func GetErrorCode(err error) int

func GetStringBuffer

func GetStringBuffer() *bytes.Buffer

func GetTagKeySizeLimit

func GetTagKeySizeLimit() int

func GetTagValueSizeLimit

func GetTagValueSizeLimit(tagKey string) int

func GetValueOfInt

func GetValueOfInt(value interface{}) int64

func GoSafe

func GoSafe(ctx context.Context, fn func())

GoSafe Safely start a goroutine, which will automatically recover from panics and print stack information.

func InterpolateJinja2 added in v0.1.9

func InterpolateJinja2(templateStr string, valMap map[string]any) (string, error)

func IsValidHexStr

func IsValidHexStr(s string) bool

func IsValidURL

func IsValidURL(u string) bool

func MapToStringString

func MapToStringString(mp map[string]string) string

func Ptr

func Ptr[T any](s T) *T

func PtrValue

func PtrValue[T any](s *T) T

func RecycleStringBuffer

func RecycleStringBuffer(buffer *bytes.Buffer)

func RmDupStrSlice

func RmDupStrSlice(slice []string) []string

func Stringify

func Stringify(value interface{}) string

func ToJSON

func ToJSON(param interface{}) string

func TruncateStringByByte

func TruncateStringByByte(valueStr string, limit int) (string, bool)

func TruncateStringByChar

func TruncateStringByChar(s string, n int) string

TruncateStringByChar Truncate the string to the first n characters

Types

This section is empty.

Jump to

Keyboard shortcuts

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