pkg

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 16 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 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 Ordered](arr []T, v T) bool

InSlice 判断是否存在某个元素

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 Float](s []T, sep string, prec int) string

func JoinInt

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

func JoinUint

func JoinUint[T 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 SplitFloat

func SplitFloat[T Float](s, sep string) ([]T, error)

func SplitInt

func SplitInt[T Signed](s, sep string) ([]T, error)

func SplitUInt

func SplitUInt[T Unsigned](s, sep string) ([]T, error)

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

type Complex

type Complex interface {
	~complex64 | ~complex128
}

type Float

type Float interface {
	~float32 | ~float64
}

type Integer

type Integer interface {
	Signed | Unsigned
}

type Ordered

type Ordered interface {
	Integer | Float | ~string
}

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Jump to

Keyboard shortcuts

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