Migrate guuid.
This commit is contained in:
33
code/tool/uuid/example_test.go
Normal file
33
code/tool/uuid/example_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
package uuid_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/eyebluecn/tank/code/tool/uuid"
|
||||
)
|
||||
|
||||
func ExampleNewV4() {
|
||||
u4, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
fmt.Println("error:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(u4)
|
||||
}
|
||||
|
||||
func ExampleNewV5() {
|
||||
u5, err := uuid.NewV5(uuid.NamespaceURL, []byte("nu7hat.ch"))
|
||||
if err != nil {
|
||||
fmt.Println("error:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(u5)
|
||||
}
|
||||
|
||||
func ExampleParseHex() {
|
||||
u, err := uuid.ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
|
||||
if err != nil {
|
||||
fmt.Println("error:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(u)
|
||||
}
|
Reference in New Issue
Block a user