From 1df3e411918850a062127d222d2db0175525c47e Mon Sep 17 00:00:00 2001 From: Sudo-Ivan Date: Thu, 1 Jan 2026 00:59:12 -0600 Subject: [PATCH] feat: implement MsgpackMarshal and MsgpackUnmarshal functions for MessagePack encoding and decoding --- pkg/common/msgpack.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pkg/common/msgpack.go diff --git a/pkg/common/msgpack.go b/pkg/common/msgpack.go new file mode 100644 index 0000000..eb52f4e --- /dev/null +++ b/pkg/common/msgpack.go @@ -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) +} +