adder.go 661 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Code generated by goctl. DO NOT EDIT!
  2. // Source: add.proto
  3. //go:generate mockgen -destination ./adder_mock.go -package adder -source $GOFILE
  4. package adder
  5. import (
  6. "context"
  7. "bookstore/rpc/add/add"
  8. "github.com/tal-tech/go-zero/zrpc"
  9. )
  10. type (
  11. AddReq = add.AddReq
  12. AddResp = add.AddResp
  13. Adder interface {
  14. Add(ctx context.Context, in *AddReq) (*AddResp, error)
  15. }
  16. defaultAdder struct {
  17. cli zrpc.Client
  18. }
  19. )
  20. func NewAdder(cli zrpc.Client) Adder {
  21. return &defaultAdder{
  22. cli: cli,
  23. }
  24. }
  25. func (m *defaultAdder) Add(ctx context.Context, in *AddReq) (*AddResp, error) {
  26. client := add.NewAdderClient(m.cli.Conn())
  27. return client.Add(ctx, in)
  28. }