Package uuid
Functions
NewUUID
graph/uuid.go
func NewUUID() UUID
Creates a new random-based universally unique identifier (UUID).
ToUUID
graph/uuid.go
func ToUUID(s string) (UUID, error)
Parameters:
-
s: A UUID string representation (
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee). It doesn’t matter if the UUID is random-based, time-based or hash-based, as long as it is in the expected format.
Returns:
-
On success, returns an equivalent UUID from the UUID string representation.
-
An error, if the UUID string representation cannot be parsed.
Example:
uuid, err := ToUUID("5e2a0a65-1b33-44fa-8ba2-947f83b16be6")
if err != nil {
panic(err)
}
fmt.Println("Success!")
UUID.ToString
graph/uuid.go
func (u UUID) ToString() string
Convert the UUID into its string representation.
Returns:
-
A string representation of u.
Examples:
uuid := NewUUID()
fmt.Println(uuid.ToString()) // 5e2a0a65-1b33-44fa-8ba2-947f83b16be6