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

Method serviceKeys

state.go:258–276  ·  view source on GitHub ↗

serviceKeys returns a slice containing all keys present for services in the application's State.

()

Source from the content-addressed store, hash-verified

256
257// serviceKeys returns a slice containing all keys present for services in the application's State.
258func (s *State) serviceKeys() []string {
259 // Pre-allocate with estimated capacity to reduce allocations
260 keys := make([]string, 0, 8)
261 s.dependencies.Range(func(key, _ any) bool {
262 keyStr, ok := key.(string)
263 if !ok {
264 return true
265 }
266
267 if !strings.HasPrefix(keyStr, s.servicePrefix) {
268 return true // Continue iterating if key doesn't have service prefix
269 }
270
271 keys = append(keys, keyStr)
272 return true
273 })
274
275 return keys
276}
277
278// Services returns a map containing all services present in the State.
279// The key is the hash of the service String() value and the value is the service itself.

Callers 2

ServicesMethod · 0.95
TestState_ServiceFunction · 0.80

Calls 1

RangeMethod · 0.65

Tested by 1

TestState_ServiceFunction · 0.64