Home / Function/ BindBody() — gin Function Reference

BindBody() — gin Function Reference

Architecture documentation for the BindBody() function in protobuf.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  7af949f9_0e89_e429_39e9_8cbfba97ebfe["BindBody()"]
  5dd1591c_0290_fab5_32fd_afc89e6964a4["Bind()"]
  5dd1591c_0290_fab5_32fd_afc89e6964a4 -->|calls| 7af949f9_0e89_e429_39e9_8cbfba97ebfe
  style 7af949f9_0e89_e429_39e9_8cbfba97ebfe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/protobuf.go lines 29–41

func (protobufBinding) BindBody(body []byte, obj any) error {
	msg, ok := obj.(proto.Message)
	if !ok {
		return errors.New("obj is not ProtoMessage")
	}
	if err := proto.Unmarshal(body, msg); err != nil {
		return err
	}
	// Here it's same to return validate(obj), but until now we can't add
	// `binding:""` to the struct which automatically generate by gen-proto
	return nil
	// return validate(obj)
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does BindBody() do?
BindBody() is a function in the gin codebase.
What calls BindBody()?
BindBody() is called by 1 function(s): Bind.

Analyze Your Own Codebase

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

Try Supermodel Free