Documentation
¶
Overview ¶
Package utils 工具类
Index ¶
- Variables
- func Contains(val string, slice []string) bool
- func DecodeHttpBody(body io.ReadCloser, obj interface{}) error
- func FirstKey(m map[string]any) string
- func InSlice(s string, slice ...string) bool
- func Int64Ptr(v int64) *int64
- func InterfaceToString(obj interface{}) string
- func MapToSlice[K comparable, V any](m map[K]V) []K
- func SafeValue[T any](v T) T
- func SliceToMap(slice []string) map[string]any
- func String2Slice(s string) []byte
- func StringPtr(v string) *string
- func StringPtrs(vals []string) []*string
- func SumSliceInt64(s []int64) int64
- type AtomicMapStat
- type ResMutex
- type ResourceLocks
Constants ¶
This section is empty.
Variables ¶
View Source
var JSONTool = jsoniter.ConfigFastest
Functions ¶
func DecodeHttpBody ¶
func DecodeHttpBody(body io.ReadCloser, obj interface{}) error
func InterfaceToString ¶
func InterfaceToString(obj interface{}) string
func MapToSlice ¶
func MapToSlice[K comparable, V any](m map[K]V) []K
func SliceToMap ¶
func String2Slice ¶
func StringPtrs ¶
func SumSliceInt64 ¶
Types ¶
type AtomicMapStat ¶
func (*AtomicMapStat) Add ¶
func (a *AtomicMapStat) Add(id string, n int)
func (*AtomicMapStat) Get ¶
func (a *AtomicMapStat) Get(id string) int
func (*AtomicMapStat) Has ¶
func (a *AtomicMapStat) Has(id string) bool
type ResourceLocks ¶
type ResourceLocks struct {
// contains filtered or unexported fields
}
func NewResourceLocks ¶
func NewResourceLocks() *ResourceLocks
func (*ResourceLocks) Len ¶
func (r *ResourceLocks) Len() int
func (*ResourceLocks) Lock ¶
func (r *ResourceLocks) Lock(resource string) func()
Click to show internal directories.
Click to hide internal directories.