1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00
Files
.github
api
auth
broker
client
cmd
codec
config
debug
errors
examples
.github
api
api
meta
proxy
rpc
proto
api.micro.go
api.pb.go
api.proto
README.md
rpc.go
README.md
booking
broker
client
command
config
event
filter
flags
form
function
gateway
getip
graceful
greeter
heartbeat
helloworld
kubernetes
metadata
mocking
noproto
options
plugins
proxy
pubsub
redirect
roundrobin
secure
server
service
sharding
shutdown
stream
template
tunnel
waitgroup
web
wrapper
LICENSE
README.md
_config.yml
go.mod
go.sum
logger
metadata
network
plugins
registry
runtime
selector
server
store
sync
transport
util
.gitignore
Dockerfile
LICENSE
README.md
_config.yml
event.go
function.go
function_test.go
generate.go
go.mod
go.sum
micro.go
options.go
service.go
service_test.go
go-micro/examples/api/rpc/proto/api.micro.go

161 lines
3.9 KiB
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
// Code generated by protoc-gen-micro. DO NOT EDIT.
2020-12-26 15:21:29 +00:00
// source: github.com/micro/go-micro/examples/api/rpc/proto/api.proto
2020-12-26 15:17:20 +00:00
/*
Package api is a generated protocol buffer package.
It is generated from these files:
2020-12-26 15:21:29 +00:00
github.com/micro/go-micro/examples/api/rpc/proto/api.proto
2020-12-26 15:17:20 +00:00
It has these top-level messages:
CallRequest
CallResponse
EmptyRequest
EmptyResponse
*/
package api
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
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.ProtoPackageIsVersion2 // 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 Example service
type ExampleService interface {
Call(ctx context.Context, in *CallRequest, opts ...client.CallOption) (*CallResponse, error)
}
type exampleService struct {
c client.Client
serviceName string
}
func NewExampleService(serviceName string, c client.Client) ExampleService {
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "example"
}
return &exampleService{
c: c,
serviceName: serviceName,
}
}
func (c *exampleService) Call(ctx context.Context, in *CallRequest, opts ...client.CallOption) (*CallResponse, error) {
req := c.c.NewRequest(c.serviceName, "Example.Call", in)
out := new(CallResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Example service
type ExampleHandler interface {
Call(context.Context, *CallRequest, *CallResponse) error
}
func RegisterExampleHandler(s server.Server, hdlr ExampleHandler, opts ...server.HandlerOption) {
type example interface {
Call(ctx context.Context, in *CallRequest, out *CallResponse) error
}
type Example struct {
example
}
h := &exampleHandler{hdlr}
s.Handle(s.NewHandler(&Example{h}, opts...))
}
type exampleHandler struct {
ExampleHandler
}
func (h *exampleHandler) Call(ctx context.Context, in *CallRequest, out *CallResponse) error {
return h.ExampleHandler.Call(ctx, in, out)
}
// Client API for Foo service
type FooService interface {
Bar(ctx context.Context, in *EmptyRequest, opts ...client.CallOption) (*EmptyResponse, error)
}
type fooService struct {
c client.Client
serviceName string
}
func NewFooService(serviceName string, c client.Client) FooService {
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "foo"
}
return &fooService{
c: c,
serviceName: serviceName,
}
}
func (c *fooService) Bar(ctx context.Context, in *EmptyRequest, opts ...client.CallOption) (*EmptyResponse, error) {
req := c.c.NewRequest(c.serviceName, "Foo.Bar", in)
out := new(EmptyResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Foo service
type FooHandler interface {
Bar(context.Context, *EmptyRequest, *EmptyResponse) error
}
func RegisterFooHandler(s server.Server, hdlr FooHandler, opts ...server.HandlerOption) {
type foo interface {
Bar(ctx context.Context, in *EmptyRequest, out *EmptyResponse) error
}
type Foo struct {
foo
}
h := &fooHandler{hdlr}
s.Handle(s.NewHandler(&Foo{h}, opts...))
}
type fooHandler struct {
FooHandler
}
func (h *fooHandler) Bar(ctx context.Context, in *EmptyRequest, out *EmptyResponse) error {
return h.FooHandler.Bar(ctx, in, out)
}