add bookstore example
This commit is contained in:
23
example/bookstore/api/internal/svc/servicecontext.go
Normal file
23
example/bookstore/api/internal/svc/servicecontext.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"bookstore/api/internal/config"
|
||||
"bookstore/rpc/add/adder"
|
||||
"bookstore/rpc/check/checker"
|
||||
|
||||
"github.com/tal-tech/go-zero/rpcx"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Adder adder.Adder
|
||||
Checker checker.Checker
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
Adder: adder.NewAdder(rpcx.MustNewClient(c.Add)),
|
||||
Checker: checker.NewChecker(rpcx.MustNewClient(c.Check)),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user