Home / File/ binder.go — fiber Source File

binder.go — fiber Source File

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

File go DataBinding Extractors 1 imports 2 functions 12 classes

Entity Profile

Dependency Diagram

graph LR
  14953c29_f514_138a_5f5e_f487057187bd["binder.go"]
  fcef1725_af89_d6cd_36cd_b228cdcc5acd["errors"]
  14953c29_f514_138a_5f5e_f487057187bd --> fcef1725_af89_d6cd_36cd_b228cdcc5acd
  style 14953c29_f514_138a_5f5e_f487057187bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package binder

import (
	"errors"
	"sync"
)

// Binder errors
var (
	ErrSuitableContentNotFound = errors.New("binder: suitable content not found to parse body")
	ErrMapNotConvertible       = errors.New("binder: map is not convertible to map[string]string or map[string][]string")
	ErrMapNilDestination       = errors.New("binder: map destination is nil and cannot be initialized")
	ErrInvalidDestinationValue = errors.New("binder: invalid destination value")
	ErrUnmatchedBrackets       = errors.New("unmatched brackets")
)

var errPoolTypeAssertion = errors.New("failed to type-assert to T")

var HeaderBinderPool = sync.Pool{
	New: func() any {
		return &HeaderBinding{}
	},
}

var RespHeaderBinderPool = sync.Pool{
	New: func() any {
		return &RespHeaderBinding{}
	},
}

var CookieBinderPool = sync.Pool{
	New: func() any {
		return &CookieBinding{}
	},
}

var QueryBinderPool = sync.Pool{
	New: func() any {
		return &QueryBinding{}
	},
}

var FormBinderPool = sync.Pool{
	New: func() any {
		return &FormBinding{}
	},
}

var URIBinderPool = sync.Pool{
	New: func() any {
		return &URIBinding{}
	},
}

var XMLBinderPool = sync.Pool{
	New: func() any {
		return &XMLBinding{}
	},
}

var JSONBinderPool = sync.Pool{
	New: func() any {
		return &JSONBinding{}
	},
}

var CBORBinderPool = sync.Pool{
	New: func() any {
		return &CBORBinding{}
	},
}

var MsgPackBinderPool = sync.Pool{
	New: func() any {
		return &MsgPackBinding{}
	},
}

// GetFromThePool retrieves a binder from the provided sync.Pool and panics if
// the stored value cannot be cast to the requested type.
func GetFromThePool[T any](pool *sync.Pool) T {
	binder, ok := pool.Get().(T)
	if !ok {
		panic(errPoolTypeAssertion)
	}

	return binder
}

// PutToThePool returns the binder to the provided sync.Pool.
func PutToThePool[T any](pool *sync.Pool, binder T) {
	pool.Put(binder)
}

Domain

Subdomains

Dependencies

  • errors

Frequently Asked Questions

What does binder.go do?
binder.go is a source file in the fiber codebase, written in go. It belongs to the DataBinding domain, Extractors subdomain.
What functions are defined in binder.go?
binder.go defines 2 function(s): GetFromThePool, PutToThePool.
What does binder.go depend on?
binder.go imports 1 module(s): errors.
Where is binder.go in the architecture?
binder.go is located at binder/binder.go (domain: DataBinding, subdomain: Extractors, directory: binder).

Analyze Your Own Codebase

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

Try Supermodel Free