util

package
v1.8.20220610 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertKind

func ConvertKind(k reflect.Kind) reflect.Kind

func DeepCopy

func DeepCopy(dst, src interface{})

深拷贝 结构体、切片、数组之间递归深拷贝 整数、浮点数、字符串、布尔类型直接拷贝,其他类型忽略 增加tag alias 2020-04-29 结构体匿名字段可拷贝 2020-07-16 修复源数据字段拷贝时跳过

func EqualJSON added in v1.2.0

func EqualJSON(a, b interface{}) bool

compare a,b json string

func GUID

func GUID() string

func GetTimerSet

func GetTimerSet() *timerSet

func InArray added in v1.1.0

func InArray(array interface{}, some interface{}) int

func NewTimerSet

func NewTimerSet() *timerSet

func ResetTimer

func ResetTimer(t *Timer, d time.Duration)

func SkipPeriodTime

func SkipPeriodTime(start time.Time, d time.Duration) time.Time

func StopTimer

func StopTimer(t *Timer)

Types

type Bitmap

type Bitmap struct {
	Num  int
	Bits []uint8 // 低位在前
}

func NewBitmap

func NewBitmap(n int) *Bitmap

func (*Bitmap) IsZero added in v1.4.0

func (bm *Bitmap) IsZero(n int) bool

func (*Bitmap) MarshalJSON

func (bm *Bitmap) MarshalJSON() ([]byte, error)

func (*Bitmap) NumZero added in v1.4.0

func (bm *Bitmap) NumZero() int

func (Bitmap) Rand

func (bm Bitmap) Rand() int

func (Bitmap) Set

func (bm Bitmap) Set(k, n int)

func (*Bitmap) UnmarshalJSON

func (bm *Bitmap) UnmarshalJSON(buf []byte) error

type Timer

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

func NewPeriodTimer

func NewPeriodTimer(f func(), start time.Time, period time.Duration) *Timer

func NewTimer

func NewTimer(f func(), d time.Duration) *Timer

func (*Timer) Expire

func (timer *Timer) Expire() time.Time

func (*Timer) IsValid

func (timer *Timer) IsValid() bool

type TimerGroup

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

func (*TimerGroup) NewPeriodTimer

func (g *TimerGroup) NewPeriodTimer(f func(), start time.Time, period time.Duration) *Timer

func (*TimerGroup) NewTimer

func (g *TimerGroup) NewTimer(f func(), d time.Duration) *Timer

func (*TimerGroup) ResetTimer

func (g *TimerGroup) ResetTimer(t **Timer, f func(), d time.Duration)

func (*TimerGroup) StopAllTimer

func (g *TimerGroup) StopAllTimer()

type UUID added in v1.7.20210824

type UUID uuid.UUID

func NewUUID added in v1.7.20210824

func NewUUID() UUID

Jump to

Keyboard shortcuts

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