Files
go-zero/example/bookstore/rpc/add/adder/adder.go

39 lines
661 B
Go
Raw Normal View History

2020-09-03 23:26:04 +08:00
// Code generated by goctl. DO NOT EDIT!
// Source: add.proto
//go:generate mockgen -destination ./adder_mock.go -package adder -source $GOFILE
package adder
import (
"context"
"bookstore/rpc/add/add"
2020-09-27 11:10:21 +08:00
2020-09-18 11:41:52 +08:00
"github.com/tal-tech/go-zero/zrpc"
2020-09-03 23:26:04 +08:00
)
type (
AddReq = add.AddReq
AddResp = add.AddResp
2020-09-03 23:26:04 +08:00
Adder interface {
Add(ctx context.Context, in *AddReq) (*AddResp, error)
}
defaultAdder struct {
2020-09-18 11:41:52 +08:00
cli zrpc.Client
2020-09-03 23:26:04 +08:00
}
)
2020-09-18 11:41:52 +08:00
func NewAdder(cli zrpc.Client) Adder {
2020-09-03 23:26:04 +08:00
return &defaultAdder{
cli: cli,
}
}
func (m *defaultAdder) Add(ctx context.Context, in *AddReq) (*AddResp, error) {
client := add.NewAdderClient(m.cli.Conn())
return client.Add(ctx, in)
2020-09-03 23:26:04 +08:00
}