Skip to content

Commit

Permalink
fix: 修改 groupOperator 的方法为小些,内部方法
Browse files Browse the repository at this point in the history
  • Loading branch information
tangx committed Dec 8, 2021
1 parent d193ed7 commit 73fd9ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rum/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _ Operator = (*RouterGroup)(nil)
var _ GroupOperator = (*RouterGroup)(nil)

type GroupOperator interface {
RouterGroup() *RouterGroup
routerGroup() *RouterGroup
}

type RouterGroup struct {
Expand Down Expand Up @@ -40,7 +40,7 @@ func NewRouterGroup(path string) *RouterGroup {
}

// RouterGroup 实现 GroupOperator interface
func (r *RouterGroup) RouterGroup() *RouterGroup {
func (r *RouterGroup) routerGroup() *RouterGroup {
return r
}

Expand All @@ -50,7 +50,7 @@ func (r *RouterGroup) Register(ops ...Operator) {
for _, op := range ops {
// 加入 子路由
if groupOp, ok := op.(GroupOperator); ok {
r.children[groupOp.RouterGroup()] = true
r.children[groupOp.routerGroup()] = true
continue
}

Expand Down
7 changes: 7 additions & 0 deletions rum/launch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package rum

func AddRootRoute(e *Engine, root Operator) *Engine {
e.Register(root)

return e
}

0 comments on commit 73fd9ac

Please sign in to comment.