UUID in Go: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions 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 15: | Line 17: | ||
<syntaxhighlight lang='go'> | <syntaxhighlight lang='go'> | ||
uuid := uuid.New() | uuid := uuid.New() | ||
</syntaxhighlight> | |||
=Conversion of a <tt>string</tt> to UUID= | |||
<syntaxhighlight lang='go'> | |||
s := "59959107-8ea1-4bb8-a5ff-eb16b3ac6532" | |||
uuid := uuid.MustParse(s) | |||
</syntaxhighlight> | </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)