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

Method Name

group.go:27–47  ·  view source on GitHub ↗

Name Assign name to specific route or group itself. If this method is used before any route added to group, it'll set group name and OnGroupNameHook will be used. Otherwise, it'll set route name and OnName hook will be used.

(name string)

Source from the content-addressed store, hash-verified

25// If this method is used before any route added to group, it'll set group name and OnGroupNameHook will be used.
26// Otherwise, it'll set route name and OnName hook will be used.
27func (grp *Group) Name(name string) Router {
28 if grp.hasAnyRoute {
29 grp.app.Name(name)
30
31 return grp
32 }
33
34 grp.app.mutex.Lock()
35 if grp.parentGroup != nil {
36 grp.name = grp.parentGroup.name + name
37 } else {
38 grp.name = name
39 }
40
41 if err := grp.app.hooks.executeOnGroupNameHooks(*grp); err != nil {
42 panic(err)
43 }
44 grp.app.mutex.Unlock()
45
46 return grp
47}
48
49// Use registers a middleware route that will match requests
50// with the provided prefix (which is optional and defaults to "/").

Callers

nothing calls this directly

Calls 4

NameMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected