Home / File/ yaml.go — gin Source File

yaml.go — gin Source File

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

Relationship Graph

Source Code

// Copyright 2018 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/goccy/go-yaml"
)

type yamlBinding struct{}

func (yamlBinding) Name() string {
	return "yaml"
}

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

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

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

Subdomains

Functions

Types

Dependencies

  • bytes

Frequently Asked Questions

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