Documentation ¶
Index ¶
- func AESDecrypt(data, key string) (result string, err error)
- func AESEncrypt(data, key string) (result string, err error)
- func AlignStringMappingArrayFields(data []map[string]string) []map[string]string
- func CallerFuncName() string
- func ChannelAsyncPush[T any](ch chan T, data T)
- func Chunk[T any](data []T, size uint) (result [][]T)
- func Cmd(c CmdOption) (result []byte, err error)
- func Contains[T any](data []T, value T, equal func(item, value T) bool) bool
- func CopyStringMapping(data map[string]string) (result map[string]string)
- func CopyStringMappingArray(data []map[string]string) (result []map[string]string)
- func CountBy[T any](data []T, f func(item T) bool) int64
- func EmbeddingCos(vector1, vector2 []float64) float64
- func EnvToBool(name string, value bool) bool
- func EnvToInt(name string, value int) int
- func EnvToString(name string, value string) string
- func GetCurrentDir() string
- func GetFieldValue(field string, data interface{}) interface{}
- func GetFieldValues(field string, data interface{}) []interface{}
- func GroupBy[T any, P comparable](data []T, key func(item T) (P, bool)) (result map[P][]T)
- func InArray[T comparable](array []T, data T) (result bool)
- func Intersect[T any](equal func(a, b T) bool, data ...[]T) []T
- func IntersectIgnoreNil[T any](equal func(a, b T) bool, all ...[]T) []T
- func IsBool(value interface{}) bool
- func IsDir(f string) bool
- func IsEmpty(value interface{}) bool
- func IsEqualSlice[T comparable](value1, value2 []T) bool
- func IsExistsPath(f string) bool
- func IsFloat(value interface{}) bool
- func IsInt(value interface{}) bool
- func IsMap(value interface{}) bool
- func IsNil(value interface{}, traceSource ...bool) bool
- func IsNumber(s string) bool
- func IsSlice(value interface{}) bool
- func IsString(value interface{}) bool
- func IsStruct(value interface{}) bool
- func IsUint(value interface{}) bool
- func KeyBy[T any, P comparable](data []T, key func(item T) (P, bool)) (result map[P]T)
- func MappingBy[T, V any, K comparable](data []T, f func(item T) (K, V)) (result map[K]V)
- func Md5(data []byte) string
- func Merge[T any](equal func(a, b T) bool, data ...[]T) []T
- func MkDirAll(f string, perm os.FileMode) (err error)
- func OrderBy[T any](data []T, compare func(first, second T) (result bool))
- func PasswordHash(password string) (hash string, err error)
- func PasswordVerify(password, hash string) bool
- func Pluck[T any, P comparable](array []T, key func(item T) P) (result []P)
- func PrintMemory(ctx context.Context, interval int64, ...)
- func RandomInt(min, max int) int
- func RandomStr(length int, randomType RandomType) string
- func Recover() func()
- func ReplaceAll(src string, old []string, new string) string
- func SHA1(data string) string
- func SwitchSlice[A, B any](data []A, f func(item A) (result B)) []B
- func SwitchStruct[A any, B any](source A, target B) error
- func ToBool(s string) bool
- func ToCamel(data string) string
- func ToCamelWithChars(data string, chars []string) string
- func ToFloat32(s string) float32
- func ToFloat64(s string) float64
- func ToInt(s string) int
- func ToInt32(s string) int32
- func ToInt64(s string) int64
- func ToInt8(s string) int8
- func ToSnake(data string) string
- func ToSnakeWithChar(data string, r rune) string
- func ToString(data interface{}) string
- func ToUint(s string) uint
- func ToUint32(s string) uint32
- func ToUint64(s string) uint64
- func ToUint8(s string) uint8
- func TrimPath(p string) string
- func Ucfirst(s string) string
- func Unique[T comparable](data []T, equal func(a, b T) bool) []T
- func Zip(src string, dest string, ignores ...string) error
- type CmdOption
- type MemoryStatus
- type NumberInterface
- type NumberType
- type RandomType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶ added in v0.4.3
func AESEncrypt ¶ added in v0.4.3
func CallerFuncName ¶ added in v0.0.52
func CallerFuncName() string
func ChannelAsyncPush ¶ added in v0.0.52
func ChannelAsyncPush[T any](ch chan T, data T)
func CopyStringMappingArray ¶
func EmbeddingCos ¶ added in v0.0.52
EmbeddingCos 使用cosine计算向量相似度
func EnvToString ¶
func GetCurrentDir ¶ added in v0.0.52
func GetCurrentDir() string
func GetFieldValue ¶ added in v0.0.52
func GetFieldValue(field string, data interface{}) interface{}
func GetFieldValues ¶ added in v0.0.52
func GetFieldValues(field string, data interface{}) []interface{}
func GroupBy ¶ added in v0.0.52
func GroupBy[T any, P comparable](data []T, key func(item T) (P, bool)) (result map[P][]T)
GroupBy 按字段分组
func InArray ¶ added in v0.0.52
func InArray[T comparable](array []T, data T) (result bool)
InArray 数组是否存在该值
func IntersectIgnoreNil ¶ added in v0.4.10
IntersectIgnoreNil 数组交集,忽略nil元素
func IsEqualSlice ¶ added in v0.0.52
func IsEqualSlice[T comparable](value1, value2 []T) bool
IsEqualSlice 判断数组是否相等
func IsFloat ¶ added in v0.0.7
func IsFloat(value interface{}) bool
IsFloat checks whether `value` is type of float.
func IsMap ¶ added in v0.0.7
func IsMap(value interface{}) bool
IsMap checks whether `value` is type of map.
func IsSlice ¶ added in v0.0.7
func IsSlice(value interface{}) bool
IsSlice checks whether `value` is type of slice.
func IsStruct ¶ added in v0.0.7
func IsStruct(value interface{}) bool
IsStruct checks whether `value` is type of struct.
func IsUint ¶ added in v0.0.7
func IsUint(value interface{}) bool
IsUint checks whether `value` is type of uint.
func KeyBy ¶ added in v0.0.52
func KeyBy[T any, P comparable](data []T, key func(item T) (P, bool)) (result map[P]T)
KeyBy 按字段转map
func MappingBy ¶ added in v0.0.52
func MappingBy[T, V any, K comparable](data []T, f func(item T) (K, V)) (result map[K]V)
MappingBy 使用指定字段组成map
func PasswordHash ¶ added in v0.0.52
func PasswordVerify ¶ added in v0.0.52
func Pluck ¶ added in v0.0.52
func Pluck[T any, P comparable](array []T, key func(item T) P) (result []P)
Pluck 取字段值
func PrintMemory ¶ added in v0.0.52
func RandomStr ¶
func RandomStr(length int, randomType RandomType) string
func ReplaceAll ¶
ReplaceAll 多个字符串同时替换为同一个
func SwitchSlice ¶ added in v0.4.2
func SwitchSlice[A, B any](data []A, f func(item A) (result B)) []B
func SwitchStruct ¶ added in v0.4.1
func ToCamelWithChars ¶ added in v0.0.52
func ToSnakeWithChar ¶ added in v0.0.52
func Unique ¶ added in v0.0.52
func Unique[T comparable](data []T, equal func(a, b T) bool) []T
Unique 去重
Types ¶
type MemoryStatus ¶ added in v0.0.52
type NumberInterface ¶ added in v0.4.18
type NumberType ¶ added in v0.0.12
type NumberType uint8
const ( UInt NumberType = iota Int UFloat Float Positive Negative All )
type RandomType ¶
type RandomType uint8
const ( RandomType_All RandomType = iota RandomType_Number RandomType_Char RandomType_LowerChar RandomType_UpperChar RandomType_Symbol RandomType_NumberAndChar RandomType_CharAndSymbol )
Click to show internal directories.
Click to hide internal directories.