Home / File/ msgpack.go — gin Source File

msgpack.go — gin Source File

Architecture documentation for msgpack.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go RequestBinding FormBinding 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  4b248b45_e203_b93a_381e_d6ea741a6656["msgpack.go"]
  fefe783b_8987_7aed_66c9_b2860bfc32e7["bytes"]
  4b248b45_e203_b93a_381e_d6ea741a6656 --> fefe783b_8987_7aed_66c9_b2860bfc32e7
  style 4b248b45_e203_b93a_381e_d6ea741a6656 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2017 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

//go:build !nomsgpack

package binding

import (
	"bytes"
	"io"
	"net/http"

	"github.com/ugorji/go/codec"
)

type msgpackBinding struct{}

func (msgpackBinding) Name() string {
	return "msgpack"
}

func (msgpackBinding) Bind(req *http.Request, obj any) error {
	return decodeMsgPack(req.Body, obj)
}

func (msgpackBinding) BindBody(body []byte, obj any) error {
	return decodeMsgPack(bytes.NewReader(body), obj)
}

func decodeMsgPack(r io.Reader, obj any) error {
	cdc := new(codec.MsgpackHandle)
	if err := codec.NewDecoder(r, cdc).Decode(&obj); err != nil {
		return err
	}
	return validate(obj)
}

Subdomains

Functions

Dependencies

  • bytes

Frequently Asked Questions

What does msgpack.go do?
msgpack.go is a source file in the gin codebase, written in go. It belongs to the RequestBinding domain, FormBinding subdomain.
What functions are defined in msgpack.go?
msgpack.go defines 1 function(s): decodeMsgPack.
What does msgpack.go depend on?
msgpack.go imports 1 module(s): bytes.
Where is msgpack.go in the architecture?
msgpack.go is located at binding/msgpack.go (domain: RequestBinding, subdomain: FormBinding, directory: binding).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free