MCPcopy
hub / github.com/gofiber/fiber / Keys

Method Keys

state.go:72–86  ·  view source on GitHub ↗

Keys returns a slice containing all keys present in the State.

()

Source from the content-addressed store, hash-verified

70
71// Keys returns a slice containing all keys present in the State.
72func (s *State) Keys() []string {
73 // Pre-allocate with estimated capacity to reduce allocations
74 keys := make([]string, 0, 8)
75 s.dependencies.Range(func(key, _ any) bool {
76 keyStr, ok := key.(string)
77 if !ok {
78 return true
79 }
80
81 keys = append(keys, keyStr)
82 return true
83 })
84
85 return keys
86}
87
88// Len returns the number of keys in the State.
89func (s *State) Len() int {

Callers 5

TestState_ResetFunction · 0.45
TestState_KeysFunction · 0.45
BenchmarkState_KeysFunction · 0.45

Calls 1

RangeMethod · 0.65

Tested by 5

TestState_ResetFunction · 0.36
TestState_KeysFunction · 0.36
BenchmarkState_KeysFunction · 0.36