21 lines
356 B
Smarty
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}}
|
||
|
}
|
||
|
}
|