I can see how this may be useful. My understanding is that this is go lang and the person created a wrapper type UUID and this function takes the go standard library uuid.UUID and returns the wrapped UUID.
The wrapped UUID could be useful as you can then define methods for it like toInt() or something to make it implement some ID interface you have set up. It’s a common pattern in go to create a thin wrapper around an imported type so you can implement all the methods required for some interface you defined. It does make naming those thin wrappers hard because what are you supposed to name the struct that just contains a uuid?
I can see how this may be useful. My understanding is that this is go lang and the person created a wrapper type
UUID
and this function takes the go standard libraryuuid.UUID
and returns the wrappedUUID
.The wrapped
UUID
could be useful as you can then define methods for it liketoInt()
or something to make it implement someID
interface you have set up. It’s a common pattern in go to create a thin wrapper around an imported type so you can implement all the methods required for some interface you defined. It does make naming those thin wrappers hard because what are you supposed to name the struct that just contains a uuid?Yep, that person would be me and that’s exactly what I was doing, just found it funny that there was so many uuids in the piece of code.
Originally the function was named
FromUuid
but I couldn’t resist renaming it to make it even better.