[#211] blobovnicza: Refactor ID implementation

Replace UUID implementation of ID with byte slice.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-25 18:55:40 +03:00 committed by Alex Vanin
parent 53b114cf8b
commit 3028718691

View file

@ -1,17 +1,17 @@
package blobovnicza
import (
"github.com/google/uuid"
"encoding/hex"
)
// ID represents Blobovnicza identifier.
type ID uuid.UUID
type ID []byte
// NewIDFromUUID constructs ID from UUID instance.
func NewIDFromUUID(uid uuid.UUID) *ID {
return (*ID)(&uid)
// NewIDFromBytes constructs ID from byte slice.
func NewIDFromBytes(v []byte) *ID {
return (*ID)(&v)
}
func (id ID) String() string {
return (uuid.UUID)(id).String()
return hex.EncodeToString(id)
}