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

21 lines
356 B
Smarty

package svc
import (
{{.configImport}}
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
type ServiceContext struct {
Config {{.config}}
{{.middleware}}
MysqlConn sqlx.SqlConn
}
func NewServiceContext(c {{.config}}) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: sqlx.NewMysql(c.SourceMysql),
{{.middlewareAssignment}}
}
}