aboutsummaryrefslogtreecommitdiff
path: root/object/id/objectid_byte.go
blob: 8bd8ab821fa8f733766365f560bb25a30231ecf2 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package objectid

// Bytes returns a copy of the object ID bytes.
func (id ObjectID) Bytes() []byte {
	size := id.Algorithm().Size()

	return append([]byte(nil), id.data[:size]...)
}

// RawBytes returns a direct byte slice view of the object ID bytes.
//
// Use Bytes when an independent copy is required.
//
// Labels: Mut-Never.
func (id *ObjectID) RawBytes() []byte {
	size := id.Algorithm().Size()

	return id.data[:size:size]
}