logic.tpl 515 B

1234567891011121314151617181920212223242526272829
  1. package {{.pkgName}}
  2. import (
  3. {{.imports}}
  4. "net/http"
  5. )
  6. type {{.logic}} struct {
  7. logx.Logger
  8. ctx context.Context
  9. svcCtx *svc.ServiceContext
  10. req *http.Request
  11. }
  12. func New{{.logic}}(r *http.Request, svcCtx *svc.ServiceContext) *{{.logic}} {
  13. ctx := r.Context()
  14. return &{{.logic}}{
  15. Logger: logx.WithContext(ctx),
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. req: r,
  19. }
  20. }
  21. func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} {
  22. // todo: add your logic here and delete this line
  23. {{.returnString}}
  24. }