utils

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 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 any)

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

func EqualJSON

func EqualJSON(a, b any) bool

compare a,b json string

func ForbidWords

func ForbidWords(msg string) string

使用*替换msg中的屏蔽词

func GUID

func GUID() string

func GetTimerSet

func GetTimerSet() *timerSet

func InArray

func InArray(array any, some any) int

func LoadForbidWords

func LoadForbidWords(words []string)

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

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

func (*Bitmap) MarshalJSON

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

func (*Bitmap) NumZero

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

type UUID uuid.UUID

func NewUUID

func NewUUID() UUID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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