servicecontext.go 544 B

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