feat: implement MsgpackMarshal and MsgpackUnmarshal functions for MessagePack encoding and decoding

This commit is contained in:
2026-01-01 00:59:12 -06:00
parent dea65ad94c
commit 1df3e41191

18
pkg/common/msgpack.go Normal file
View File

@@ -0,0 +1,18 @@
// SPDX-License-Identifier: 0BSD
// Copyright (c) 2024-2026 Sudo-Ivan / Quad4.io
package common
import (
"github.com/shamaton/msgpack/v2"
)
// Marshal returns the MessagePack encoding of v.
func MsgpackMarshal(v interface{}) ([]byte, error) {
return msgpack.Marshal(v)
}
// Unmarshal parses the MessagePack-encoded data and stores the result in the value pointed to by v.
func MsgpackUnmarshal(data []byte, v interface{}) error {
return msgpack.Unmarshal(data, v)
}