Files
go-zero/example/bookstore/rpc/add/internal/svc/servicecontext.go
songmeizi b060867009 Feature bookstore update (#253)
* update bookstore

* update bookstore
2020-12-08 22:36:48 +08:00

21 lines
377 B
Go
Executable File

package svc
import (
"bookstore/rpc/add/internal/config"
"bookstore/rpc/model"
"github.com/tal-tech/go-zero/core/stores/sqlx"
)
type ServiceContext struct {
c config.Config
Model model.BookModel
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
c: c,
Model: model.NewBookModel(sqlx.NewMysql(c.DataSource), c.Cache),
}
}