diff --git a/common/db.go b/common/db.go index b1d67fd..80757e9 100644 --- a/common/db.go +++ b/common/db.go @@ -88,3 +88,10 @@ func (d DataTyp) ToBytes() []byte { binary.BigEndian.PutUint16(bytes, uint16(d)) return bytes } + +// Convert int to []byte +func IntToBytes(value int) []byte { + bytes := make([]byte, 2) + binary.BigEndian.PutUint16(bytes, uint16(value)) + return bytes +}