Documentation
¶
Index ¶
- func ArrayKeys[K comparable, V any](m map[K]V) []K
- func ArrayValues[K comparable, V any](m map[K]V) []V
- func CallbackGo(fn func(), callback func())
- func Chunk[T any](data []T, size int) [][]T
- func Filter[T any](data []T, f func(T) bool) []T
- func FindIndex[T any](data []T, f func(T) bool) int
- func FindItem[T comparable](data []T, target T) int
- func ForEach[T any](data []T, f func(T) error) error
- func GenerateCacheKey(v interface{}) (string, error)
- func InArray[T comparable](target T, data []T) bool
- func Map[T any, K any](data []T, f func(T) K) []K
- func MapByKey[T any, K comparable](base []T, keyFunc func(T) K) map[K]T
- func MapColumn[T any, U any](slice []T, extractor func(T) U) []U
- func Reverse[T any](data []T)
- func SafeGo(fn func())
- func SetPanicHandler(hd func(info interface{}))
- func Unique[T comparable](data []T) []T
- type CacheItem
- type LocalCache
- type OnceErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayKeys ¶
func ArrayKeys[K comparable, V any](m map[K]V) []K
func ArrayValues ¶
func ArrayValues[K comparable, V any](m map[K]V) []V
func CallbackGo ¶
func CallbackGo(fn func(), callback func())
CallbackGo 安全使用go的同时,额外的保证在goroutine执行结束后调用回调函数,即使panic也会出发回调
func FindItem ¶
func FindItem[T comparable](data []T, target T) int
func GenerateCacheKey ¶
GenerateCacheKey 生成缓存key
func InArray ¶
func InArray[T comparable](target T, data []T) bool
func MapByKey ¶
func MapByKey[T any, K comparable](base []T, keyFunc func(T) K) map[K]T
func SetPanicHandler ¶
func SetPanicHandler(hd func(info interface{}))
SetPanicHandler 统一将goroutine的panic管理起来
func Unique ¶
func Unique[T comparable](data []T) []T
Types ¶
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
LocalCache 本地缓存结构体
Click to show internal directories.
Click to hide internal directories.