-
Notifications
You must be signed in to change notification settings - Fork 0
/
variant.go
31 lines (28 loc) · 856 Bytes
/
variant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package uuid
// Variant is a UUID variant as per the RFC 4122, § 4.1.1.
type Variant byte
const (
// VariantNCS is a reserved variant for NCS backward compatibility.
VariantNCS Variant = 0x00
// VariantRFC4122 is the current variant defined by the RFC 4122.
VariantRFC4122 Variant = 0x80 // 10xxxxxx
// VariantMicrosoft is a reserved variant for Microsoft Corporation backward compatibility.
VariantMicrosoft Variant = 0xC0 // 110xxxxx
// VariantUndefined is a reserved variant for future definition (still undefined).
VariantUndefined Variant = 0xE0 // 111xxxxx
variantByte byte = 8
)
func (v Variant) String() string {
switch v {
case VariantNCS:
return "NCS"
case VariantRFC4122:
return "RFC 4122"
case VariantMicrosoft:
return "Microsoft"
case VariantUndefined:
return "Undefined"
default:
return "No variant"
}
}