1 Star 0 Fork 0

老牛 / lao-idgen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gen.go 424 Bytes
一键复制 编辑 原始数据 按行查看 历史
老牛 提交于 2022-04-02 20:51 . first add
package lao_idgen
import (
config "gitee.com/laoniu11/lao-config"
"github.com/yitter/idgenerator-go/idgen"
"math/rand"
"strconv"
)
func init() {
wid := config.GetInt("appid", rand.Intn(64))
ops := idgen.NewIdGeneratorOptions(uint16(wid))
idgen.SetIdGenerator(ops)
}
func NextId() uint64 {
return idgen.NextId()
}
func NextIdStr() string {
theId := idgen.NextId()
return strconv.FormatInt(int64(theId), 10)
}
1
https://gitee.com/laoniu11/lao-idgen.git
git@gitee.com:laoniu11/lao-idgen.git
laoniu11
lao-idgen
lao-idgen
master

搜索帮助