Home / File/ bson.go — gin Source File

bson.go — gin Source File

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

File go 1 imports

Entity Profile

Dependency Diagram

graph LR
  5f245df1_63cc_1ec8_217f_419e4545ecd4["bson.go"]
  0d816439_76ee_c7fb_5329_a059811a793a["io"]
  5f245df1_63cc_1ec8_217f_419e4545ecd4 --> 0d816439_76ee_c7fb_5329_a059811a793a
  style 5f245df1_63cc_1ec8_217f_419e4545ecd4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2025 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package binding

import (
	"io"
	"net/http"

	"go.mongodb.org/mongo-driver/bson"
)

type bsonBinding struct{}

func (bsonBinding) Name() string {
	return "bson"
}

func (b bsonBinding) Bind(req *http.Request, obj any) error {
	buf, err := io.ReadAll(req.Body)
	if err == nil {
		err = b.BindBody(buf, obj)
	}
	return err
}

func (bsonBinding) BindBody(body []byte, obj any) error {
	return bson.Unmarshal(body, obj)
}

Types

Dependencies

  • io

Frequently Asked Questions

What does bson.go do?
bson.go is a source file in the gin codebase, written in go.
What does bson.go depend on?
bson.go imports 1 module(s): io.
Where is bson.go in the architecture?
bson.go is located at binding/bson.go (directory: binding).

Analyze Your Own Codebase

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

Try Supermodel Free