23 lines
366 B
Go
23 lines
366 B
Go
package controller
|
|
|
|
type IRouterCtx interface {
|
|
GetRouteByName(string) (string, error)
|
|
}
|
|
|
|
type IControllerCtx interface {
|
|
GetRouteByName(string) string
|
|
}
|
|
|
|
type ControllerCtx struct {
|
|
RouterCtx IRouterCtx
|
|
}
|
|
|
|
func (c ControllerCtx) GetRouteByName(name string) string {
|
|
path, err := c.RouterCtx.GetRouteByName(name)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return path
|
|
}
|