UUID in Go: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=External=
=External=
* https://github.com/google/uuid
* https://github.com/google/uuid
* https://pkg.go.dev/github.com/google/uuid
=Internal=
=Internal=
* [[Go Code Examples#g4LY|Go Code Examples]]
* [[Go Code Examples#g4LY|Go Code Examples]]
Line 18: Line 20:


=Conversion of a <tt>string</tt> to UUID=
=Conversion of a <tt>string</tt> to UUID=
<syntaxhighlight lang='go'>
s := "59959107-8ea1-4bb8-a5ff-eb16b3ac6532"
uuid := uuid.MustParse(s)
</syntaxhighlight>

Latest revision as of 18:18, 1 February 2024

External

Internal

Overview

go.mod:

require (
	github.com/google/uuid v1.5.0
)
uuid := uuid.New()

Conversion of a string to UUID

s := "59959107-8ea1-4bb8-a5ff-eb16b3ac6532"
uuid := uuid.MustParse(s)