fiber/binder/msgpack.go
RW fe1bf4a0b3
feat(ctx): add conditional copy helpers (#3703)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-26 07:54:15 +02:00

34 lines
922 B
Go

package binder
import (
utils "github.com/gofiber/utils/v2"
)
// MsgPackBinding is the MsgPack binder for MsgPack request body.
type MsgPackBinding struct {
MsgPackDecoder utils.MsgPackUnmarshal
}
// Name returns the binding name.
func (*MsgPackBinding) Name() string {
return "msgpack"
}
// Bind parses the request body as MsgPack and returns the result.
func (b *MsgPackBinding) Bind(body []byte, out any) error {
return b.MsgPackDecoder(body, out)
}
// Reset resets the MsgPackBinding binder.
func (b *MsgPackBinding) Reset() {
b.MsgPackDecoder = nil
}
func UnimplementedMsgpackMarshal(_ any) ([]byte, error) {
panic("Must explicit setup Msgpack, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack")
}
func UnimplementedMsgpackUnmarshal(_ []byte, _ any) error {
panic("Must explicit setup Msgpack, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack")
}