Home / File/ toml.go — gin Source File

toml.go — gin Source File

Architecture documentation for toml.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
  5722d7ea_5921_4711_f4cb_706c3330fe7b["toml.go"]
  fefe783b_8987_7aed_66c9_b2860bfc32e7["bytes"]
  5722d7ea_5921_4711_f4cb_706c3330fe7b --> fefe783b_8987_7aed_66c9_b2860bfc32e7
  style 5722d7ea_5921_4711_f4cb_706c3330fe7b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2022 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 (
	"bytes"
	"io"
	"net/http"

	"github.com/pelletier/go-toml/v2"
)

type tomlBinding struct{}

func (tomlBinding) Name() string {
	return "toml"
}

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

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

func decodeToml(r io.Reader, obj any) error {
	decoder := toml.NewDecoder(r)
	if err := decoder.Decode(obj); err != nil {
		return err
	}
	return validate(obj)
}

Subdomains

Functions

Types

Dependencies

  • bytes

Frequently Asked Questions

What does toml.go do?
toml.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 toml.go?
toml.go defines 1 function(s): decodeToml.
What does toml.go depend on?
toml.go imports 1 module(s): bytes.
Where is toml.go in the architecture?
toml.go is located at binding/toml.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