Home / File/ bind.go — fiber Source File

bind.go — fiber Source File

Architecture documentation for bind.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Routing 1 imports 5 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  5848a0ec_2152_c223_e642_087565773529["bind.go"]
  642586d1_6654_1529_49fd_39746ef95a13["reflect"]
  5848a0ec_2152_c223_e642_087565773529 --> 642586d1_6654_1529_49fd_39746ef95a13
  style 5848a0ec_2152_c223_e642_087565773529 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package fiber

import (
	"reflect"
	"slices"
	"sync"

	"github.com/gofiber/fiber/v3/binder"
	"github.com/gofiber/utils/v2"
)

// CustomBinder An interface to register custom binders.
type CustomBinder interface {
	Name() string
	MIMETypes() []string
	Parse(c Ctx, out any) error
}

// StructValidator is an interface to register custom struct validator for binding.
type StructValidator interface {
	Validate(out any) error
}

var bindPool = sync.Pool{
	New: func() any {
		return &Bind{
			dontHandleErrs: true,
		}
	},
}

// Bind provides helper methods for binding request data to Go values.
type Bind struct {
	ctx            Ctx
	dontHandleErrs bool
	skipValidation bool
}

// AcquireBind returns Bind reference from bind pool.
func AcquireBind() *Bind {
	b, ok := bindPool.Get().(*Bind)
	if !ok {
		panic(errBindPoolTypeAssertion)
	}

	return b
}

// ReleaseBind returns b acquired via Bind to bind pool.
func ReleaseBind(b *Bind) {
	b.release()
	bindPool.Put(b)
}

// releasePooledBinder resets a binder and returns it to its pool.
// It should be used with defer to ensure proper cleanup of pooled binders.
func releasePooledBinder[T interface{ Reset() }](pool *sync.Pool, bind T) {
	bind.Reset()
	binder.PutToThePool(pool, bind)
}
// ... (321 more lines)

Domain

Subdomains

Classes

Dependencies

  • reflect

Frequently Asked Questions

What does bind.go do?
bind.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in bind.go?
bind.go defines 5 function(s): AcquireBind, ReleaseBind, isZero, mergeStruct, releasePooledBinder.
What does bind.go depend on?
bind.go imports 1 module(s): reflect.
Where is bind.go in the architecture?
bind.go is located at bind.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free