gfunc

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCountryZone

func CheckCountryZone(country, zone string, en_country, en_zone, dis_country, dis_zone *[]string) bool

func CheckRecover

func CheckRecover()

* * @Description: 检测 recover并打印错误 stack * @Date: 2022-02-19 10:33:49 *

func GenerateRoomId

func GenerateRoomId(iDGen uint64) uint64

CRC32(32 位)冲突概率 ≈ 50% 当生成 7.7 万个 ID 时(生日问题) xxHash(64 位)冲突概率 ≈ 50% 当生成 50 亿个 ID 时 实际应根据业务量选择: 中小规模(<1M ID/天):CRC32 足够 超大规模:推荐 xxHash 或 SHA1 截断

func GetGID

func GetGID() uint64

* * @Description: 获取当前协程id * @return: uint64 * @Author: Iori * @Date: 2022-02-19 10:32:39 *

func GetLocalIP

func GetLocalIP() (ip string, err error)

* * @Description: 获取本地ip地址 * @return: ip * @return: err *

func GetOutboundIP

func GetOutboundIP() string

* * @Description: 获取外网ip地址 * @return: string * @Author: Iori *

func GetTexasRoomListIndex

func GetTexasRoomListIndex(zone uint32, gameId pb.GameTypeId, coin pb.CoinType) uint64

GetTexasRoomListIndex 获取德州房间列表索引

func IfOr

func IfOr[R any](flag bool, a, b R) R

* * @Description: 三目运算之泛型 * @param: flag * @param: a * @param: b * @return: R * @Author: Iori *

func IsNull

func IsNull(i interface{}) bool

* * @Description: 是否為null值 ,default * @param: i * @return: bool * @Author: Iori *

func RecoverTraceCode

func RecoverTraceCode()

* * @Description: 检测 recover并跟踪代码 * @Date: 2022-02-26 18:00:12 *

func SendGameEventNotifyByConnBus

func SendGameEventNotifyByConnBus(connBus *map[uint64]uint32, op g1_protocol.GameNotifyType, pbMsg proto.Message) g1_protocol.ErrorCode

send game evnet notify by conn busid

func SendGameEventNotifyBybrief

func SendGameEventNotifyBybrief(uidMap *map[uint64]*g1_protocol.PbRoleBriefInfo, op g1_protocol.GameNotifyType, pbMsg proto.Message) g1_protocol.ErrorCode

------------------------------- public -------------------------------- send game evnet notify by brief info

func SendRoleOpEventNotifyToSingle

func SendRoleOpEventNotifyToSingle(busId uint32, uid uint64, op g1_protocol.GameNotifyType, pbMsg proto.Message) g1_protocol.ErrorCode

send game evnet notify to single

func StrVal

func StrVal(value interface{}) string

* * @Description: Strval 获取变量的字符串值,,浮点型 3.0将会转换成字符串3, "3",,非数值或字符类型的变量将会被转换成JSON格式字符串 * @param: value * @return: string *

func StructAssign

func StructAssign(binding interface{}, value interface{})

* * @Description: 结构体数据复制 * @param: binding 要修改的结构体 * @param: value 有数据的结构体 * @Author: Iori * @Date: 2022-02-19 10:32:57 *

func TraceCode

func TraceCode(code ...interface{})

* * @Description: 输出错误,跟踪代码 * @param: code * @Author: Iori * @Date: 2022-02-26 18:00:28 *

Types

This section is empty.

Jump to

Keyboard shortcuts

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