You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
470 B
Go
24 lines
470 B
Go
package svc
|
|
|
|
import (
|
|
"bookstore/api/internal/config"
|
|
"bookstore/rpc/add/adder"
|
|
"bookstore/rpc/check/checker"
|
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
)
|
|
|
|
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(zrpc.MustNewClient(c.Add)),
|
|
Checker: checker.NewChecker(zrpc.MustNewClient(c.Check)),
|
|
}
|
|
}
|