utils

package
v0.0.0-...-781a829 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Timer_LoopForever int = -1 //无效定时器
	Timer_Stop        int = 0  //定时器运行一次
)

Functions

func CreatePath

func CreatePath(filePath string) error

func GetRand

func GetRand(start int, end int) int

生成区间为[start, end)

func GetStackInfo

func GetStackInfo(skip int) (string, int)

获取当前调用信息

func GetStackInfoString

func GetStackInfoString(skip int) string

func HttpGet

func HttpGet(url string, retMap interface{}) error

func HttpPost

func HttpPost(url, params string, contentType string, retMap interface{}) error

func IsExist

func IsExist(path string) bool

func Logger

func Logger() *zap.SugaredLogger

func MaxInt

func MaxInt(a int, b int) int

func MaxInt64

func MaxInt64(a int64, b int64) int64

func MinInt

func MinInt(a int, b int) int

func MinInt64

func MinInt64(a int64, b int64) int64

func ReadFile

func ReadFile(filePth string) ([]byte, error)

func StartPporfService

func StartPporfService(ipstr string)

func StripFileName

func StripFileName(filename string, part int) string

将绝对路径按需要的节从右压缩 例如: /server/src/core/util/stack.go中 当cStripPathSection=3 返回 core/util/stack.go

func Unwrap

func Unwrap(num int64, retain int) float64

将int64恢复成正常的float64

func UnwrapToInt64

func UnwrapToInt64(num int64, retain int) int64

精准int64

func Wrap

func Wrap(num float64, retain int) int64

将float64转换成精确的int64

func WrapToFloat64

func WrapToFloat64(num float64, retain int) float64

精准float64

func WriteFile

func WriteFile(path string, data []byte) error

Types

type ILinerHandle

type ILinerHandle interface {
	OnLinerEvent(interface{})
}

type LinerDispatch

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

func NewLinerDispatch

func NewLinerDispatch() *LinerDispatch

func (*LinerDispatch) Add

func (ld *LinerDispatch) Add(pkt interface{})

func (*LinerDispatch) Init

func (ld *LinerDispatch) Init()

func (*LinerDispatch) RegiserCallBack

func (ld *LinerDispatch) RegiserCallBack(fc func(interface{}))

func (*LinerDispatch) Start

func (ld *LinerDispatch) Start()

func (*LinerDispatch) Stop

func (ld *LinerDispatch) Stop()

type PacketList

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

func NewPacketList

func NewPacketList() *PacketList

func (*PacketList) Add

func (pl *PacketList) Add(p interface{})

func (*PacketList) BeginPick

func (pl *PacketList) BeginPick() []interface{}

func (*PacketList) Close

func (pl *PacketList) Close()

func (*PacketList) EndPick

func (pl *PacketList) EndPick()

func (*PacketList) Len

func (pl *PacketList) Len() int

func (*PacketList) Reset

func (pl *PacketList) Reset()

type TimerItem

type TimerItem struct {
	TimerFunc func()
}

Jump to

Keyboard shortcuts

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