Go語言生成GUID和UUID
阿新 • • 發佈:2019-02-03
1.安裝
go get -u github.com/typa01/go-utils
import (
"github.com/typa01/go-utils"
)
使用,例:fieldNames := tsgutils.NewInterfaceBuilder()
1.生成GUID
func TestGUID(t *testing.T) {
FmtPrintln("GUID: " + GUID())
}
結果: GUID: 80509ffeb2ac2aa8abf9126319cb719c
2.生成UUID
func TestUUID(t *testing.T) { FmtPrintln("UUID: " + UUID()) }
結果: UUID: 6b2cfd01-2466-e51b-d90a-a72ef662b9e2
3.GitHub原始碼地址
https://github.com/typa01/go-utils
https://github.com/typa01/go-utils/blob/master/id_generator.go