utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelKeys

func DelKeys(baseMap *sync.Map, keys []interface{}) error

* 从map中删除指定的key

* PARAMS: * - baseMap: 要删除key的map * - keys: 要删除的key数组

func FindExclusiveKey

func FindExclusiveKey(baseMap, yMap *sync.Map) ([]interface{}, error)

* 找出在baseMap中存在但yMap中不存在的元素 * * PARAMS: * - baseMap: 独有元素所在的map * - yMap: 对比map * * RETURNS: * baseMap中独有元素的key的数组

func GetFirstNoneLoopIp

func GetFirstNoneLoopIp() (string, error)

func MergeSyncMap

func MergeSyncMap(fromMap, toMap *sync.Map) error

* 两个map取并集 * * PARAMS: * - fromMap: 源map * - toMap: 合并后的map *

func NewStopwatch

func NewStopwatch() *stopwatch

创建一个计时器

func RandomByWeight

func RandomByWeight(weight []int) int

根据权重值生成随机落点; weight: 权重数组, 例如传1,2,3, 则会按1:2:3的概率生成 return: 此次落点的索引, 索引值对应于传入参数weight

Types

This section is empty.

Jump to

Keyboard shortcuts

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