package svc import ( "github.com/zeromicro/go-zero/core/stores/sqlx" "live-service/app/user_center/model" "live-service/app/user_center/rpc/internal/config" ) type ServiceContext struct { Config config.Config UserModel model.UserModel UserPlatformModel model.UserPlatformModel } func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, UserModel: model.NewUserModel(sqlx.NewMysql(c.DB.DataSource)), UserPlatformModel: model.NewUserPlatformModel(sqlx.NewMysql(c.DB.DataSource)), } }