fusenapi/goctl_template/api/logic.tpl
2023-06-05 17:56:55 +08:00

27 lines
569 B
Smarty

package {{.pkgName}}
import (
{{.imports}}
)
type {{.logic}} struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} {
return &{{.logic}}{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *{{.logic}}) {{.function}}({{.request}}) (resp *types.Response) {
// response, Code码, . (eg): resp.Set(501, "error")
resp = &types.Response{}
{{.returnString}} resp
}