utils

package
v0.0.0-...-72af66c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package utils 工具类

Index

Constants

This section is empty.

Variables

Functions

func Contains

func Contains(val string, slice []string) bool

func DecodeHttpBody

func DecodeHttpBody(body io.ReadCloser, obj interface{}) error

func FirstKey

func FirstKey(m map[string]any) string

func InSlice

func InSlice(s string, slice ...string) bool

func Int64Ptr

func Int64Ptr(v int64) *int64

func InterfaceToString

func InterfaceToString(obj interface{}) string

func MapToSlice

func MapToSlice[K comparable, V any](m map[K]V) []K

func SafeValue

func SafeValue[T any](v T) T

func SliceToMap

func SliceToMap(slice []string) map[string]any

func String2Slice

func String2Slice(s string) []byte

func StringPtr

func StringPtr(v string) *string

func StringPtrs

func StringPtrs(vals []string) []*string

func SumSliceInt64

func SumSliceInt64(s []int64) int64

Types

type AtomicMapStat

type AtomicMapStat struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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 ResMutex

type ResMutex struct {
	// contains filtered or unexported fields
}

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL