summaryrefslogtreecommitdiff
path: root/pkg/btrfs/uuid.go
blob: b9e3e0c538027cdce7eef195011703f119b95e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package btrfs

import (
	"bytes"
	"encoding/hex"
	"strings"
)

type UUID [16]byte

func (uuid UUID) String() string {
	str := hex.EncodeToString(uuid[:])
	return strings.Join([]string{
		str[:8],
		str[8:12],
		str[12:16],
		str[16:20],
		str[20:32],
	}, "-")
}

func (a UUID) Equal(b UUID) bool {
	return bytes.Equal(a[:], b[:])
}