fusenapi/goctl_template/api/context.tpl

21 lines
356 B
Smarty
Raw Normal View History

2023-06-05 09:56:55 +00:00
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}}
}
}