layout.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package uuid
  2. import (
  3. "github.com/golang-plus/uuid/internal"
  4. )
  5. // Layout represents the layout of UUID. See page 5 in RFC 4122.
  6. type Layout byte
  7. const (
  8. // LayoutInvalid represents invalid layout.
  9. LayoutInvalid = Layout(internal.LayoutInvalid)
  10. // LayoutNCS represents the layout: Reserved, NCS backward compatibility.
  11. LayoutNCS = Layout(internal.LayoutNCS)
  12. // LayoutRFC4122 represents the layout: The variant specified in RFC 4122.
  13. LayoutRFC4122 = Layout(internal.LayoutRFC4122)
  14. // LayoutMicrosoft represents the layout: Reserved, Microsoft Corporation backward compatibility.
  15. LayoutMicrosoft = Layout(internal.LayoutMicrosoft)
  16. // LayoutFuture represents the layout: Reserved for future definition.
  17. LayoutFuture = Layout(internal.LayoutFuture)
  18. )
  19. // String returns English description of layout.
  20. func (l Layout) String() string {
  21. switch l {
  22. case LayoutNCS:
  23. return "Reserved For NCS"
  24. case LayoutRFC4122:
  25. return "RFC 4122"
  26. case LayoutMicrosoft:
  27. return "Reserved For Microsoft"
  28. case LayoutFuture:
  29. return "Reserved For Future"
  30. default:
  31. return "Invalid"
  32. }
  33. }