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.
25 lines
548 B
25 lines
548 B
package svc
|
|
|
|
import (
|
|
"demo/internal/config"
|
|
dbModel "demo/model"
|
|
pgModel "demo/model/pgTest"
|
|
|
|
_ "github.com/lib/pq"
|
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
|
)
|
|
|
|
type ServiceContext struct {
|
|
Config config.Config
|
|
DbModel dbModel.TeThoroughlyRegisterModel
|
|
PgModel pgModel.TestModel
|
|
}
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
|
conn := sqlx.NewSqlConn("postgres", c.Pg.DataSource)
|
|
return &ServiceContext{
|
|
Config: c,
|
|
DbModel: dbModel.NewTeThoroughlyRegisterModel(conn),
|
|
PgModel: pgModel.NewTestModel(conn),
|
|
}
|
|
}
|
|
|