Home / File/ data.go — fiber Source File

data.go — fiber Source File

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

File go FiberMiddleware Session 1 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  f73d22a6_74ad_d960_ed34_56fdde3a9486["data.go"]
  4a89612e_cb9d_437c_e107_9ce21cddffbe["sync"]
  f73d22a6_74ad_d960_ed34_56fdde3a9486 --> 4a89612e_cb9d_437c_e107_9ce21cddffbe
  style f73d22a6_74ad_d960_ed34_56fdde3a9486 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package session

import (
	"sync"
)

// msgp -file="data.go" -o="data_msgp.go" -tests=true -unexported
// Session state should remain small to fit common storage payload limits.
//
//go:generate msgp -o=data_msgp.go -tests=true -unexported
//msgp:ignore data
type data struct {
	Data         map[any]any // Session key counts are expected to be bounded.
	sync.RWMutex `msg:"-"`
}

var dataPool = sync.Pool{
	New: func() any {
		d := new(data)
		d.Data = make(map[any]any)
		return d
	},
}

// acquireData returns a new data object from the pool.
//
// Returns:
//   - *data: The data object.
//
// Usage:
//
//	d := acquireData()
func acquireData() *data {
	obj := dataPool.Get()
	if d, ok := obj.(*data); ok {
		return d
	}
	// Handle unexpected type in the pool
	panic("unexpected type in data pool")
}

// Reset clears the data map and resets the data object.
//
// Usage:
//
//	d.Reset()
func (d *data) Reset() {
	d.Lock()
	defer d.Unlock()
	clear(d.Data)
}

// Get retrieves a value from the data map by key.
//
// Parameters:
//   - key: The key to retrieve.
//
// Returns:
//   - any: The value associated with the key.
//
// ... (70 more lines)

Subdomains

Functions

Classes

Types

Dependencies

  • sync

Frequently Asked Questions

What does data.go do?
data.go is a source file in the fiber codebase, written in go. It belongs to the FiberMiddleware domain, Session subdomain.
What functions are defined in data.go?
data.go defines 1 function(s): acquireData.
What does data.go depend on?
data.go imports 1 module(s): sync.
Where is data.go in the architecture?
data.go is located at middleware/session/data.go (domain: FiberMiddleware, subdomain: Session, directory: middleware/session).

Analyze Your Own Codebase

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

Try Supermodel Free