Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap UUID format to byte array #556

Merged
merged 1 commit into from
May 4, 2022

Commits on Apr 21, 2022

  1. Swap UUID format to byte array

    With oapi-codegen#546 merged in, UUIDs are defined as an alias for a string.
    
    Before that implementation gets mass adoption, I wanted to propose a
    slightly different alternative: basing the custom type off of
    `uuid.UUID` over `string`.
    
    This has the advantages of:
    - Being convertable back to a `uuid.UUID` without having to parse the
      string a second time, or opening the conversion up to failure
      scenarios
    - Still being easily convertable to `string` with the `uuid.UUID`'s
      `String` method
    - Taking up less space in memory
    - Reducing the number of invalid representations, since only `[16]byte`s
      can be represented, as opposed to all strings
    - Not adding any dependencies, since `uuid.UUID` is already being
      imported
    rliebz committed Apr 21, 2022
    Configuration menu
    Copy the full SHA
    184ea74 View commit details
    Browse the repository at this point in the history