1 Star 0 Fork 11

黑妞/guuid

forked from dreamans/guuid 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
util.go 735 Bytes
一键复制 编辑 原始数据 按行查看 历史
dreamans 提交于 2018-03-21 16:42 . first commit
// This file is part of the guuid package
//
// (c) Dreamans <[email protected]>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
package guuid
import (
"encoding/hex"
"encoding/binary"
"time"
mrand "math/rand"
)
func uint32ToHexString(n uint32) string {
return byteToHexString(uint32ToBin(n))
}
func byteToHexString(n []byte) string {
return hex.EncodeToString(n)
}
func uint32ToBin(n uint32) []byte {
uintByte := make([]byte, 4, 4)
binary.BigEndian.PutUint32(uintByte, n)
return uintByte
}
func timeStamp() uint32 {
return uint32(time.Now().Unix())
}
func rand() uint32 {
return uint32(mrand.Int31())
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/black_luk/guuid.git
[email protected]:black_luk/guuid.git
black_luk
guuid
guuid
master

搜索帮助