You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
453 B
22 lines
453 B
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),
|
|
}
|
|
}
|
|
|