22 Star 77 Fork 13

freshcn / go-id-builder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tools.go 542 Bytes
一键复制 编辑 原始数据 按行查看 历史
freshcn 提交于 2015-09-07 02:17 . 初始化信息
package main
import (
"os"
"os/exec"
"path/filepath"
"strconv"
)
// 工具函数集
// 返回配置中的每次最大申请ID值
func getPreStep() int64 {
var preStep int64 = 1000
tmpPreStep, b := config.Get("", "per_step")
if b {
intPreStep, err := strconv.ParseInt(tmpPreStep, 10, 64)
if err != nil {
return preStep
}
preStep = intPreStep
}
return preStep
}
// 返回当前的运行目录
func runPath() string {
path, err := exec.LookPath(os.Args[0])
if err != nil {
panic(err)
}
return filepath.Dir(path)
}
Go
1
https://gitee.com/freshcn/go-id-builder.git
git@gitee.com:freshcn/go-id-builder.git
freshcn
go-id-builder
go-id-builder
master

搜索帮助