From 7d3478958134e6ca13bada1d93b27119814813b7 Mon Sep 17 00:00:00 2001 From: Maxim Bublis Date: Tue, 18 Jun 2013 23:04:48 +0400 Subject: [PATCH] added examples --- examples_test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 examples_test.go diff --git a/examples_test.go b/examples_test.go new file mode 100644 index 0000000..ff1f2ba --- /dev/null +++ b/examples_test.go @@ -0,0 +1,42 @@ +package uuid_test + +import ( + "fmt" + "github.com/satori/uuid" +) + +func ExampleNewV1() { + u1, err := uuid.NewV1() + if err != nil { + fmt.Println("Error: ", err) + return + } + fmt.Println(u1) +} + +func ExampleNewV3() { + u3, err := uuid.NewV3(uuid.NamespaceDNS, "golang.org") + if err != nil { + fmt.Println("Error: ", err) + return + } + fmt.Println(u3) +} + +func ExampleNewV4() { + u4, err := uuid.NewV4() + if err != nil { + fmt.Println("Error: ", err) + return + } + fmt.Println(u4) +} + +func ExampleNewV5() { + u5, err := uuid.NewV5(uuid.NamespaceDNS, "golang.org") + if err != nil { + fmt.Println("Error: ", err) + return + } + fmt.Println(u5) +}