utility

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevConfig configType = iota
	TestConfig
	ProdConfig
	OtherConfig
)

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

func GetCurrentPath

func GetCurrentPath() string

func InitConfig

func InitConfig[T any](path string) T

初始化

func IntArrJoinString

func IntArrJoinString(arr []int, spilt string) string

func JsonBodyToObj

func JsonBodyToObj[T any](data []byte) (result T)

func JsonToObj

func JsonToObj[T any](str string) T

func LoadConfig

func LoadConfig[T any](path string) T

从配置文件中载入json字符串

func MD5

func MD5(str string) string

func SetConfig

func SetConfig[T any](path string) T

初始化 可以运行多次

func SliceExcept added in v1.0.7

func SliceExcept[T1 any, T2 any, T3 any](slice1 []T1, slice2 []T2, compare func(T1, T2) bool, returnValue func(T1) T3) []T3

func SliceExceptSame added in v1.0.8

func SliceExceptSame[T any](slice1, slice2 []T, compare func(T, T) bool) []T

func SliceIntersect added in v1.0.7

func SliceIntersect[T1 any, T2 any, T3 any](slice1 []T1, slice2 []T2, compare func(T1, T2) bool, returnValue func(T1, T2) T3) []T3

func SliceIntersectSame added in v1.0.8

func SliceIntersectSame[T any](slice1, slice2 []T, compare func(T, T) bool) []T

func SliceUnion added in v1.0.7

func SliceUnion[T any](slice1, slice2 []T, compare func(T, T) bool) []T

func StrToIntArr

func StrToIntArr(str string) []int

func SubString

func SubString(str string, begin, length int) string

func ToJson

func ToJson(t interface{}) string

func ToJsonBody

func ToJsonBody(t interface{}) []byte

func ToXML added in v1.0.6

func ToXML(t interface{}) string

func ToXMLBody added in v1.0.6

func ToXMLBody(t interface{}) []byte

func XMLBodyToObj

func XMLBodyToObj[T any](data []byte) (result T)

func XMLToObj

func XMLToObj[T any](str string) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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