Documentation ¶
Index ¶
- 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 CopyStringMapping(data map[string]string) (result map[string]string)
- func CopyStringMappingArray(data []map[string]string) (result []map[string]string)
- 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 InArrayFloat64(data float64, array []float64) bool
- func InArrayInt(data int, array []int) bool
- func InArrayString(data string, array []string) bool
- 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 any, K, V comparable](data []T, f func(item T) (K, V)) (result map[K]V)
- func Md5(data []byte) string
- 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 ReplaceAll(src string, old []string, new string) string
- func SHA1(data string) string
- func StructSliceToStructSlice[A, B any](data []A, f func(item A) (result B)) []B
- 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) []T
- func Zip(src string, dest string, ignores ...string) error
- type CmdOption
- type MemoryStatus
- type NumberType
- type RandomType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 InArrayFloat64 ¶
InArrayFloat64 判断是否在数组中,float64
func InArrayString ¶
InArrayString 判断是否在数组中,string
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 any, K, V 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 StructSliceToStructSlice ¶ added in v0.0.52
func StructSliceToStructSlice[A, B any](data []A, f func(item A) (result B)) []B
func ToCamelWithChars ¶ added in v0.0.52
func ToSnakeWithChar ¶ added in v0.0.52
Types ¶
type MemoryStatus ¶ added in v0.0.52
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_NumberAndSymbol RandomType_CharAndSymbol )
Click to show internal directories.
Click to hide internal directories.