style.go 646 B

1234567891011121314151617181920212223
  1. package uuid
  2. // Style represents the style of UUID string.
  3. type Style byte
  4. const (
  5. // StyleStandard represents the standard style of UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12, length: 36).
  6. StyleStandard Style = iota + 1
  7. // StyleWithoutDash represents the style without dash of UUID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (length: 32).
  8. StyleWithoutDash
  9. )
  10. // String returns English description of style.
  11. func (s Style) String() string {
  12. switch s {
  13. case StyleStandard:
  14. return "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12)"
  15. case StyleWithoutDash:
  16. return "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  17. default:
  18. return "Unknown"
  19. }
  20. }