servicecontext.go 377 B

12345678910111213141516171819202122
  1. // Code scaffolded by goctl. Safe to edit.
  2. // goctl 1.10.2
  3. package svc
  4. import (
  5. "udeServer/internal/config"
  6. "github.com/zeromicro/go-zero/core/stores/sqlx"
  7. )
  8. type ServiceContext struct {
  9. Config config.Config
  10. DB sqlx.SqlConn
  11. }
  12. func NewServiceContext(c config.Config) *ServiceContext {
  13. return &ServiceContext{
  14. Config: c,
  15. DB: sqlx.MustNewConn(c.MySQL),
  16. }
  17. }