fusenapi/home-user-auth/internal/svc/servicecontext.go
2023-06-01 18:35:09 +08:00

26 lines
630 B
Go

package svc
import (
"fusenapi/home-user-auth/internal/config"
"fusenapi/model"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
type ServiceContext struct {
Config config.Config
FsFontModel model.FsFontModel
FsCanteenTypeModel model.FsCanteenTypeModel
FsUserModel model.FsUserModel
}
func NewServiceContext(c config.Config) *ServiceContext {
conn := sqlx.NewMysql(c.DataSource)
return &ServiceContext{
Config: c,
FsFontModel: model.NewFsFontModel(conn),
FsCanteenTypeModel: model.NewFsCanteenTypeModel(conn),
FsUserModel: model.NewFsUserModel(conn),
}
}