• Not_mikey@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    16
    ·
    edit-2
    3 days ago

    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?

    • Rikudou_Sage@lemmings.worldOP
      link
      fedilink
      arrow-up
      13
      ·
      3 days ago

      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.