servicecontext.go 405 B

12345678910111213141516171819
  1. package svc
  2. import (
  3. "github.com/tal-tech/go-zero/core/stores/sqlx"
  4. "points_service/rpc/internal/config"
  5. "points_service/rpc/model"
  6. )
  7. type ServiceContext struct {
  8. Config config.Config
  9. Model model.IntegralBalanceModel
  10. }
  11. func NewServiceContext(c config.Config) *ServiceContext {
  12. return &ServiceContext{
  13. Config: c,
  14. Model: model.NewIntegralBalanceModel(sqlx.NewMysql(c.DataSource),c.Cache),
  15. }
  16. }