util

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) int

func Atoi64

func Atoi64(s string) int64

func Atou

func Atou(s string) uint64

func ContainsInt32

func ContainsInt32(slice []int32, i int32) bool

func DayCount added in v0.6.1

func DayCount(a time.Time, b time.Time) int

2个日期的相隔天数

func GenUniqueId

func GenUniqueId() int64

生成唯一id

func GetCurrentMS

func GetCurrentMS() int64

获取当前毫秒数(毫秒,0.001秒)

func GetCurrentTimeStamp

func GetCurrentTimeStamp() uint32

获取当前时间戳(秒)

func GetMessageIdByComponentMessageName

func GetMessageIdByComponentMessageName(packageName, componentStructName, messageName string) int32

根据组件名和消息名获取对应的消息号 packageName是*.proto文件里定义的package名

func GetMessageIdByMessageName

func GetMessageIdByMessageName(packageName, componentStructName, messageName string) int32

根据消息名获取对应的消息号 packageName是*.proto文件里定义的package名

func HasString

func HasString(slice []string, s string) bool

func IndexString

func IndexString(slice []string, s string) int

func InitIdGenerator

func InitIdGenerator(workerId uint16)

func IsNil

func IsNil(i interface{}) bool

interface{}判断是否为空 不能简单的==nil

func Itoa

func Itoa(i interface{}) string

func ToDate added in v0.6.1

func ToDate(t time.Time) time.Time

去除Time中的时分秒,只保留日期

func ToDateInt added in v0.6.1

func ToDateInt(t time.Time) int32

转换成20240219格式

func ToString

func ToString(i interface{}) (string, error)

func ToStringWithoutError added in v1.1.0

func ToStringWithoutError(i interface{}) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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