1 Star 4 Fork 3

tym_hmm/go-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
UniqueIdentifier.go 352 Bytes
一键复制 编辑 原始数据 按行查看 历史
天蝎儿 提交于 2021-12-21 13:45 . 修改目录结构
package go_helper
import (
SnowFlake "gitee.com/tym_hmm/go-helper/Library/snowFlake"
"strconv"
)
/**
通过雪花算法生成唯一id
*/
func GetUniqueNum(NodeId int64) (string, error) {
worker, err := SnowFlake.NewWorker(NodeId)
if err != nil {
return "0", err
}
id := worker.GetId()
idStr := strconv.FormatInt(id, 10)
return idStr, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/tym_hmm/go-helper.git
git@gitee.com:tym_hmm/go-helper.git
tym_hmm
go-helper
go-helper
v1.1.44

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385