25 lines
471 B
Go
25 lines
471 B
Go
package controller
|
|
|
|
import werror "git.markbailey.dev/cerbervs/ptpp/lib/error"
|
|
|
|
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(werror.Wrap(err, "Error getting route by name"))
|
|
}
|
|
|
|
return path
|
|
}
|