1 Star 0 Fork 0

xfx/iothub-south-client

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
snowflake_util.go 373 Bytes
一键复制 编辑 原始数据 按行查看 历史
xfx 提交于 2022-07-25 12:04 +08:00 . 1.实现接入端鉴权、失败自动重试逻辑
package util
import "github.com/bwmarrin/snowflake"
var defaultNode *snowflake.Node
func init() {
var err error
defaultNode, err = snowflake.NewNode(1)
if err != nil {
panic(err)
}
}
func NextSnowFlakeID() int64 {
id := defaultNode.Generate()
return id.Int64()
}
func NewSnowFlake(node int64) (n *snowflake.Node, err error) {
return snowflake.NewNode(node)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xfx0810/iothub-south-client.git
git@gitee.com:xfx0810/iothub-south-client.git
xfx0810
iothub-south-client
iothub-south-client
v0.7.9

搜索帮助