package svc import ( "demo/internal/config" dbModel "demo/model" _ "github.com/lib/pq" "github.com/zeromicro/go-zero/core/stores/sqlx" ) type ServiceContext struct { Config config.Config DbModel dbModel.TeThoroughlyRegisterModel } func NewServiceContext(c config.Config) *ServiceContext { conn := sqlx.NewSqlConn("postgres", c.Pg.DataSource) return &ServiceContext{ Config: c, DbModel: dbModel.NewTeThoroughlyRegisterModel(conn), } }