Documentation ¶
Index ¶
- Variables
- func Command(args string) (outStr string, errStr string, err error)
- func GenNORepeatIdx(set map[uint32]struct{}, uint32Slice []uint32) (int, error)
- func GenRandValue(except uint32, uint32Slice []uint32) (uint32, error)
- func GenRandomString(len uint32) (container string, err error)
- func GetCurrentPath() (currentPath string, err error)
- func If(condition bool, trueVal interface{}, falseVal interface{}) interface{}
- func IsDebug() bool
- func IsDuplicateUint32(uint32Slice []uint32) bool
- func IsLinux() bool
- func IsLittleEndian() bool
- func IsRelease() bool
- func IsWindows() bool
- func RandomInt(min int, max int) int
- func SplitString2Map(s string, sep1 string, sep2 string) (map[uint32]int64, error)
- func SplitString2Uint32(s string, sep string) (u32Slice []uint32, err error)
- func WeightedRandom(weights []uint32) (idx int, err error)
- type ConditionFunc
- type IDisplay
- type IObject
- type Mgr
- type RunMode
Constants ¶
This section is empty.
Variables ¶
View Source
var GRunMode = RunModeRelease
GRunMode 运行模式
Functions ¶
func GenNORepeatIdx ¶
GenNORepeatIdx 生成 不重复 序号
参数: set:已有数据 uint32Slice:从该slice中随机一个,与set中不重复 返回值: unit32Slice 中的index
func GenRandValue ¶
GenRandValue 生成 随机值
参数: except:排除 数据 uint32Slice:从该slice中随机一个,与except不重复 返回值: unit32Slice 中的值
func GetCurrentPath ¶
GetCurrentPath 获取当前程序 所在 路径
[×] 支持 win 下 link/快捷方式 [✔] 支持 linux ln -s on linux host:ln -s /home/xxx/battle001/battle-linux.exe.001 /home/xxx/zone2/battle001/btl.exe 执行btl.exe 输出:service current path:/home/xxx/zone2/battle001
func If ¶
func If(condition bool, trueVal interface{}, falseVal interface{}) interface{}
If 三目运算符 NOTE 传递的实参,会在调用时计算
func IsDuplicateUint32 ¶
IsDuplicateUint32 是否有重复uint32
func SplitString2Map ¶
SplitString2Map 拆分字符串, 返回key为uint32类型、val为int64类型的map
func SplitString2Uint32 ¶
SplitString2Uint32 拆分字符串, 返回 uint32 类型的 slice
func WeightedRandom ¶
WeightedRandom 从权重中选出序号.[0 ... ]
NOTE 参数 weights 必须有长度 参数: weights:权重 返回值: idx:weights 的序号 idx
Types ¶
type ConditionFunc ¶
type ConditionFunc[TKey comparable, TVal IObject] func(key TKey, value TVal) bool
ConditionFunc 用于定义查找条件的函数签名
type Mgr ¶
type Mgr[TKey comparable, TVal IObject] struct { // contains filtered or unexported fields }
func (*Mgr[TKey, TVal]) FindOneWithCondition ¶
func (p *Mgr[TKey, TVal]) FindOneWithCondition(condition ConditionFunc[TKey, TVal]) (val TVal)
FindOneWithCondition 根据条件查找元素-一个
Click to show internal directories.
Click to hide internal directories.