github.com/weplanx/server@v0.2.6-0.20240318110640-f7e75155779a/xapi/index/controller.go (about) 1 package index 2 3 import ( 4 "context" 5 "github.com/cloudwego/hertz/pkg/app" 6 ) 7 8 type Controller struct { 9 IndexService *Service 10 } 11 12 func (x *Controller) Accelerate(ctx context.Context, c *app.RequestContext) { 13 r, err := x.IndexService.Accelerate(ctx) 14 if err != nil { 15 c.Error(err) 16 return 17 } 18 c.JSON(200, r) 19 }