common

package
v0.0.0-...-799f385 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 10 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRoutineID

func GetRoutineID() int

获取当前routine的id 用于测试

func GetStackStr

func GetStackStr() string

func GoPprofServe

func GoPprofServe(port string)

func NowMs

func NowMs() int64

func RandFloat32

func RandFloat32(min, max float32) float32

func SafeJsonMarshal

func SafeJsonMarshal(data interface{}) string

func SafeJsonMarshalByteArray

func SafeJsonMarshalByteArray(data interface{}) []byte

Types

type FakeMutex

type FakeMutex struct {
}

提供空的锁,便于测试同步(替代掉sync.Mutex,sync.RWMutex)

func (*FakeMutex) Lock

func (self *FakeMutex) Lock()

func (*FakeMutex) RLock

func (self *FakeMutex) RLock()

func (*FakeMutex) RUnlock

func (self *FakeMutex) RUnlock()

func (*FakeMutex) Unlock

func (self *FakeMutex) Unlock()

type IMutex

type IMutex interface {
	Lock()
	Unlock()
	RLock()
	RUnlock()
}

type SerialIdService

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

func NewSerialIdService

func NewSerialIdService() *SerialIdService

func (*SerialIdService) AllocId

func (s *SerialIdService) AllocId() uint32

type SerialIdService64

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

func NewSerialIdService64

func NewSerialIdService64() *SerialIdService64

func (*SerialIdService64) AllocId

func (s *SerialIdService64) AllocId() uint64

Jump to

Keyboard shortcuts

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