pkg

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RandStrModNumber    = 0x01
	RandStrModUpperCase = 0x02
	RandStrModLowerCase = 0x04
)
View Source
const (
	TimeFormatYear2Second = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(ciphertext []byte, key []byte, iv []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)

func ConvertMap2Slice added in v1.0.0

func ConvertMap2Slice[T, R any, K constraints.Ordered](val map[K]T, get func(T) (R, bool)) []R

func ConvertSlice2Map added in v1.0.0

func ConvertSlice2Map[T any, K constraints.Ordered](arr []T, get func(T) (K, bool)) map[K]T

func ConvertSlice2Slice added in v1.0.0

func ConvertSlice2Slice[T, R any](arr []T, get func(T) (R, bool)) []R

func Copy

func Copy(dst, src interface{}) error

func FileExist

func FileExist(path string) error

func FilesExist

func FilesExist(path ...string) error

func GetClientIp

func GetClientIp(r *http.Request) string

func InSlice

func InSlice[T comparable](arr []T, v T) bool

func InSliceElem

func InSliceElem[T any](arr []T, f func(T) bool) bool

func Ip2Long

func Ip2Long(ipStr string) uint32

func IsPublicIP

func IsPublicIP(IP net.IP) bool

func Join

func Join(s []string, sep string) string

func JoinFloat

func JoinFloat[T constraints.Float](s []T, sep string, prec int) string

func JoinInt

func JoinInt[T constraints.Signed](s []T, sep string) string

func JoinUint

func JoinUint[T constraints.Unsigned](s []T, sep string) string

func NetLong2ip

func NetLong2ip(ip uint32) string

func ParseGzip

func ParseGzip(data []byte) ([]byte, error)

func RandInt32

func RandInt32(min, max int32) int32

func RandInt64

func RandInt64(min, max int64) int64

func RandStr

func RandStr(length int, chars string, mod uint) string

RandStr 生成随机字符串

func Split

func Split(s, sep string) []string

func SubStr

func SubStr(str string, start int, end int) string

func TimeFormatInLocation

func TimeFormatInLocation(tm time.Time, layout string) string

func TimeParseInLocation

func TimeParseInLocation(layout, value string) (time.Time, error)

func VersionCompare

func VersionCompare(version1, version2, operator string) bool

版本对比

Types

This section is empty.

Jump to

Keyboard shortcuts

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