1 Star 0 Fork 0

wolferhua/go-micro-demo

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
api1.pb.micro.go 2.78 KB
一键复制 编辑 原始数据 按行查看 历史
hua 提交于 2020-02-12 12:06 +08:00 . feat meta1
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: api1.proto
package api1
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
proto1 "github.com/micro/go-micro/api/proto"
context "context"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for Api1 service
type Api1Service interface {
Get(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.Response, error)
Post(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.Response, error)
}
type api1Service struct {
c client.Client
name string
}
func NewApi1Service(name string, c client.Client) Api1Service {
return &api1Service{
c: c,
name: name,
}
}
func (c *api1Service) Get(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.Response, error) {
req := c.c.NewRequest(c.name, "Api1.Get", in)
out := new(proto1.Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *api1Service) Post(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.Response, error) {
req := c.c.NewRequest(c.name, "Api1.Post", in)
out := new(proto1.Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Api1 service
type Api1Handler interface {
Get(context.Context, *proto1.Request, *proto1.Response) error
Post(context.Context, *proto1.Request, *proto1.Response) error
}
func RegisterApi1Handler(s server.Server, hdlr Api1Handler, opts ...server.HandlerOption) error {
type api1 interface {
Get(ctx context.Context, in *proto1.Request, out *proto1.Response) error
Post(ctx context.Context, in *proto1.Request, out *proto1.Response) error
}
type Api1 struct {
api1
}
h := &api1Handler{hdlr}
return s.Handle(s.NewHandler(&Api1{h}, opts...))
}
type api1Handler struct {
Api1Handler
}
func (h *api1Handler) Get(ctx context.Context, in *proto1.Request, out *proto1.Response) error {
return h.Api1Handler.Get(ctx, in, out)
}
func (h *api1Handler) Post(ctx context.Context, in *proto1.Request, out *proto1.Response) error {
return h.Api1Handler.Post(ctx, in, out)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/wolferhua/go-micro-demo.git
git@gitee.com:wolferhua/go-micro-demo.git
wolferhua
go-micro-demo
go-micro-demo
ad582c0b0e17

搜索帮助