Categorygithub.com/mix-go/xutil
repository
1.1.19
Repository: https://github.com/mix-go/xutil.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Produced by OpenMix: https://openmix.org

Mix XUtil

A set of tools that keep Golang sweet.

Installation

go get github.com/mix-go/xutil

xslices

FunctionDescription
xslices.InArray[T comparable](item T, slice []T) boolSearches if the specified value exists in the array.

xstrings

FunctionDescription
xstrings.IsNumeric(s string) boolUsed to check if the variable is a number or a numeric string.
xstrings.SubString(s string, start int, length int) stringReturn part of a string
xstrings.Capitalize(s string) stringThe function converts the first letter of the input string to uppercase.

xconv

FunctionDescription
xconv.StructToMap(i interface{}) map[string]interface{}Convert struct to map.
xconv.StringToBytes(s string) []byteConvert string to bytes (0 copy).
xconv.BytesToString(b []byte) stringConvert bytes to bytes (0 copy).

xcrypt

FunctionDescription
xcrypt.AESEncrypt(plainText, mode, key, iv string) (string, error)AES encryption
xcrypt.AESDecrypt(cipherText, mode, key, iv string) (string, error)AES Decryption

xfmt [more]

A formatting library that can print data inside nested pointer addresses of structures.

The supported methods are identical to the fmt system library

FunctionDescription
xfmt.Sprintf(format string, args ...interface{}) string
xfmt.Sprint(args ...interface{}) string
xfmt.Sprintln(args ...interface{}) string
xfmt.Printf(format string, args ...interface{})
xfmt.Print(args ...interface{})
xfmt.Println(args ...interface{})
xfmt.Disable()Equivalent to fmt when disabled
xfmt.Enable()

xenv [more]

Environment configuration library with type conversion.

FunctionDescription
err := xenv.Load(".env")
err := xenv.Overload(".env")
i := xenv.Getenv("key").String("default")
i := xenv.Getenv("key").Bool(false)
i := xenv.Getenv("key").Int64(123)
i := xenv.Getenv("key").Float64(123.4)

License

Apache License Version 2.0, http://www.apache.org/licenses/