[#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 package blobovnicza
import ( import (
"github.com/google/uuid" "encoding/hex"
) )
// ID represents Blobovnicza identifier. // ID represents Blobovnicza identifier.
type ID uuid.UUID type ID []byte
// NewIDFromUUID constructs ID from UUID instance. // NewIDFromBytes constructs ID from byte slice.
func NewIDFromUUID(uid uuid.UUID) *ID { func NewIDFromBytes(v []byte) *ID {
return (*ID)(&uid) return (*ID)(&v)
} }
func (id ID) String() string { func (id ID) String() string {
return (uuid.UUID)(id).String() return hex.EncodeToString(id)
} }