Documentation ¶
Index ¶
- Constants
- func AesDecrypt(ciphertext []byte, key []byte, iv []byte) ([]byte, error)
- func AesEncrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)
- func BitCount[V constraints.Unsigned](v V) int
- func Copy(dst, src interface{}) error
- func FileExist(path string) error
- func FilesExist(path ...string) error
- func FloatToString[R constraints.Float](v R, prec int) string
- func GetClientIp(r *http.Request) string
- func IntegerToString[R constraints.Integer](v R) string
- func Ip2Long(ipStr string) uint32
- func IsPublicIP(IP net.IP) bool
- func JoinFloat[T constraints.Float](s []T, sep string, prec int) string
- func JoinInt[T constraints.Signed](s []T, sep string) string
- func JoinUint[T constraints.Unsigned](s []T, sep string) string
- func Map2Slice[T, R any, K constraints.Ordered](s map[K]T, fn func(k K, v T) R) []R
- func Map2SliceFilter[T, R any, K constraints.Ordered](val map[K]T, get func(T) (R, bool)) []R
- func MapForEach[K constraints.Ordered, T any](val map[K]T, handle func(K) error) error
- func MapKeys[K constraints.Ordered, V any](m map[K]V) []K
- func MapValues[K constraints.Ordered, V any](m map[K]V) []V
- func Md5(str string) string
- func NetLong2ip(ip uint32) string
- func ParseGzip(data []byte) ([]byte, error)
- func RandInt(min, max int) int
- func RandString(length int, chars string, mod uint8) string
- func RandStringEx(length int) string
- func Slice2Map[E any, K constraints.Ordered](s []E, fn func(v *E) K) map[K]*E
- func Slice2MapEx[T, V any, K constraints.Ordered](arr []T, get func(*T) (K, V)) map[K]V
- func Slice2MapExFilter[T, V any, K constraints.Ordered](arr []T, get func(*T) (K, V, bool)) map[K]V
- func Slice2MapFilter[E any, K constraints.Ordered](s []E, fn func(v *E) (K, bool)) map[K]*E
- func Slice2Slice[T, R any](arr []T, get func(*T) R) []R
- func Slice2SliceFilter[T, R any](arr []T, get func(*T) (R, bool)) []R
- func SliceDifference[E constraints.Ordered](sliceList ...[]E) []E
- func SliceForEach[T any](arr []T, handle func(T) bool) bool
- func SliceForEachIdx(l int, handle func(i int) bool) bool
- func SliceIntersect[E constraints.Ordered](sliceList ...[]E) []E
- func SliceSortAsc[T constraints.Ordered](v []T) []T
- func SliceSortDesc[T constraints.Ordered](v []T) []T
- func SliceUnion[E constraints.Ordered](sliceList ...[]E) []E
- func SliceUnique[E constraints.Ordered](v []E) []E
- func SplitFloat[T constraints.Float](s, sep string) ([]T, error)
- func SplitInt[T constraints.Signed](s, sep string) ([]T, error)
- func SplitSlice(v SplitSliceData, sHandle func(b, e int) error) error
- func SplitSliceEx(v SplitSliceData, sHandle func(b, e int) error, eHandle func(i int) error) error
- func SplitUint[T constraints.Unsigned](s, sep string) ([]T, error)
- func StringMerge(str ...string) string
- func StringToFloat(v string) float64
- func StringToInteger(v string) int
- func SubStr(str string, start int, end int) string
- func TimeFormatInLocation(tm time.Time, layout string) string
- func TimeParseInLocation(layout, value string) (time.Time, error)
- func ToFloat(key interface{}) float64
- func ToInt(key interface{}) int
- func ToString(key interface{}, limit ...int) string
- func VersionCompare(version1, version2, operator string) bool
- type EmptyStruct
- type JsonRawUnmarshalString
- type JsonStringMarshalStruct
- type Map4Any
- type Set
- type SplitSliceData
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 BitCount ¶
func BitCount[V constraints.Unsigned](v V) int
func FilesExist ¶
func FloatToString ¶
func FloatToString[R constraints.Float](v R, prec int) string
func IntegerToString ¶
func IntegerToString[R constraints.Integer](v R) string
func JoinFloat ¶
func JoinFloat[T constraints.Float](s []T, sep string, prec int) string
JoinFloat join 浮点型
func Map2Slice ¶
func Map2Slice[T, R any, K constraints.Ordered](s map[K]T, fn func(k K, v T) R) []R
Map2Slice map 转 切片
func Map2SliceFilter ¶
func Map2SliceFilter[T, R any, K constraints.Ordered](val map[K]T, get func(T) (R, bool)) []R
Map2SliceFilter map 转 切片, 并过滤对应数据
func MapForEach ¶
func MapForEach[K constraints.Ordered, T any](val map[K]T, handle func(K) error) error
func RandStringEx ¶
func Slice2Map ¶
func Slice2Map[E any, K constraints.Ordered](s []E, fn func(v *E) K) map[K]*E
Slice2Map 切片 转 map
func Slice2MapEx ¶
func Slice2MapEx[T, V any, K constraints.Ordered](arr []T, get func(*T) (K, V)) map[K]V
Slice2MapEx 切片 转 map
func Slice2MapExFilter ¶
func Slice2MapExFilter[T, V any, K constraints.Ordered](arr []T, get func(*T) (K, V, bool)) map[K]V
Slice2MapExFilter 切片 转 map, 并过滤对应数据
func Slice2MapFilter ¶
func Slice2MapFilter[E any, K constraints.Ordered](s []E, fn func(v *E) (K, bool)) map[K]*E
Slice2MapFilter 切片 转 map, 并过滤对应数据
func Slice2SliceFilter ¶
Slice2SliceFilter 切片 转 切片, 并过滤对应数据
func SliceDifference ¶
func SliceDifference[E constraints.Ordered](sliceList ...[]E) []E
SliceDifference 切片差集
func SliceForEachIdx ¶
SliceForEachIdx 切片遍历
func SliceIntersect ¶
func SliceIntersect[E constraints.Ordered](sliceList ...[]E) []E
SliceIntersect 切片交集
func SplitFloat ¶
func SplitFloat[T constraints.Float](s, sep string) ([]T, error)
SplitFloat split 切割 float
func SplitInt ¶
func SplitInt[T constraints.Signed](s, sep string) ([]T, error)
SplitInt split 切割 int
func SplitSlice ¶
func SplitSlice(v SplitSliceData, sHandle func(b, e int) error) error
SplitSlice split 切割 split
func SplitSliceEx ¶
SplitSliceEx split 切割 split
func SplitUint ¶
func SplitUint[T constraints.Unsigned](s, sep string) ([]T, error)
SplitUint split 切割 uint
func StringMerge ¶
func StringToFloat ¶
func StringToInteger ¶
Types ¶
type EmptyStruct ¶
type EmptyStruct struct{}
type JsonRawUnmarshalString ¶
type JsonRawUnmarshalString string
func (*JsonRawUnmarshalString) UnmarshalJSON ¶
func (s *JsonRawUnmarshalString) UnmarshalJSON(bytes []byte) error
type JsonStringMarshalStruct ¶
type JsonStringMarshalStruct string
func (JsonStringMarshalStruct) MarshalJSON ¶
func (v JsonStringMarshalStruct) MarshalJSON() ([]byte, error)
type Set ¶
type Set[T constraints.Ordered] map[T]EmptyStruct
func Slice2Set ¶
func Slice2Set[E any, K constraints.Ordered](s []E, fn func(v *E) K) Set[K]
Slice2Set 切片结构体转换为 map[结构体Field]struct{}
func Slice2SetFilter ¶
func Slice2SetFilter[E any, K constraints.Ordered](s []E, fn func(v *E) (K, bool)) Set[K]
Slice2SetFilter 切片结构体转换为 map[结构体Field]struct{}
type SplitSliceData ¶
SplitSliceData split 切割 slice 数据结构
Source Files ¶
Click to show internal directories.
Click to hide internal directories.