diff options
| author | Eltrac <hi@guhub.cn> | 2025-12-03 14:39:33 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-12-03 14:39:33 +0800 |
| commit | 8871615c98bce3c2c3aa871ce4e80126558cb91b (patch) | |
| tree | 6b43f2412313bad00a9aea6a42631220684d69ae | |
| parent | f7643a06846043cf932cf3d2eb7f49be5322ca56 (diff) | |
feat: nested grouping
| -rw-r--r-- | group.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -18,6 +18,17 @@ func (e *Engine) Group(prefix string, fn func(*Group)) { fn(g) } +// Group.Group creates a nested Group +// joining all prefixes of parent groups +func(g *Group) Group(prefix string, fn func(*Group)) { + nested := &Group { + prefix: joinPath(g.prefix, prefix), + engine: g.engine, + } + + fn(nested) +} + /* Inherit Engine methods */ func (g *Group) GET(path string, handler Handler) { |
