package user import ( "net/http" "github.com/labstack/echo" "gorm.io/gorm" ) type Controller struct { client *gorm.DB group string } func (*Controller) GetLogin(ctx echo.Context) error { return ctx.String(http.StatusOK, "success") } func (s *Controller) RegisterRoute(echo *echo.Echo) { echo.GET("/login", s.GetLogin) } // New 获取用户模块的控制器 // // 参数 // - gorm.DB 该模块所使用的数据库链接 // // 返回值 // - Controller 控制器的实例指针 func New(client *gorm.DB) *Controller { return &Controller{client} }