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)
| 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. |
| 27 | func (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 "/"). |
nothing calls this directly
no test coverage detected