Files
go-zero/example/bookstore/rpc/check/internal/svc/servicecontext.go

21 lines
379 B
Go
Raw Normal View History

2020-09-03 23:26:04 +08:00
package svc
import (
"bookstore/rpc/check/internal/config"
"bookstore/rpc/model"
"github.com/tal-tech/go-zero/core/stores/sqlx"
)
type ServiceContext struct {
c config.Config
Model model.BookModel
2020-09-03 23:26:04 +08:00
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
c: c,
Model: model.NewBookModel(sqlx.NewMysql(c.DataSource), c.Cache),
2020-09-03 23:26:04 +08:00
}
}