servicecontext.go 440 B

1234567891011121314151617181920212223
  1. package svc
  2. import (
  3. "fmt"
  4. "git.i2edu.net/i2/i2-bill-erp/internal/config"
  5. "git.i2edu.net/i2/i2-bill-erp/model"
  6. "git.i2edu.net/i2/go-zero/core/stores/sqlx"
  7. )
  8. type ServiceContext struct {
  9. Config config.Config
  10. Model model.StudentModel
  11. }
  12. func NewServiceContext(c config.Config) *ServiceContext {
  13. fmt.Println(c.Cache)
  14. return &ServiceContext{
  15. Config: c,
  16. Model: model.NewStudentModel(sqlx.NewMysql(c.DataSource), c.Cache),
  17. }
  18. }