Skip to content

Instantly share code, notes, and snippets.

@TRomesh
Last active October 4, 2021 03:52
Show Gist options
  • Save TRomesh/cc4e414e139ce47ba19a3a2482b37faa to your computer and use it in GitHub Desktop.
Save TRomesh/cc4e414e139ce47ba19a3a2482b37faa to your computer and use it in GitHub Desktop.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package pokemonpc
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// PokemonServiceClient is the client API for PokemonService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PokemonServiceClient interface {
CreatePokemon(ctx context.Context, in *CreatePokemonRequest, opts ...grpc.CallOption) (*CreatePokemonResponse, error)
ReadPokemon(ctx context.Context, in *ReadPokemonRequest, opts ...grpc.CallOption) (*ReadPokemonResponse, error)
UpdatePokemon(ctx context.Context, in *UpdatePokemonRequest, opts ...grpc.CallOption) (*UpdatePokemonResponse, error)
DeletePokemon(ctx context.Context, in *DeletePokemonRequest, opts ...grpc.CallOption) (*DeletePokemonResponse, error)
ListPokemon(ctx context.Context, in *ListPokemonRequest, opts ...grpc.CallOption) (PokemonService_ListPokemonClient, error)
}
type pokemonServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPokemonServiceClient(cc grpc.ClientConnInterface) PokemonServiceClient {
return &pokemonServiceClient{cc}
}
func (c *pokemonServiceClient) CreatePokemon(ctx context.Context, in *CreatePokemonRequest, opts ...grpc.CallOption) (*CreatePokemonResponse, error) {
out := new(CreatePokemonResponse)
err := c.cc.Invoke(ctx, "/pokemon.PokemonService/CreatePokemon", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokemonServiceClient) ReadPokemon(ctx context.Context, in *ReadPokemonRequest, opts ...grpc.CallOption) (*ReadPokemonResponse, error) {
out := new(ReadPokemonResponse)
err := c.cc.Invoke(ctx, "/pokemon.PokemonService/ReadPokemon", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokemonServiceClient) UpdatePokemon(ctx context.Context, in *UpdatePokemonRequest, opts ...grpc.CallOption) (*UpdatePokemonResponse, error) {
out := new(UpdatePokemonResponse)
err := c.cc.Invoke(ctx, "/pokemon.PokemonService/UpdatePokemon", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokemonServiceClient) DeletePokemon(ctx context.Context, in *DeletePokemonRequest, opts ...grpc.CallOption) (*DeletePokemonResponse, error) {
out := new(DeletePokemonResponse)
err := c.cc.Invoke(ctx, "/pokemon.PokemonService/DeletePokemon", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokemonServiceClient) ListPokemon(ctx context.Context, in *ListPokemonRequest, opts ...grpc.CallOption) (PokemonService_ListPokemonClient, error) {
stream, err := c.cc.NewStream(ctx, &PokemonService_ServiceDesc.Streams[0], "/pokemon.PokemonService/ListPokemon", opts...)
if err != nil {
return nil, err
}
x := &pokemonServiceListPokemonClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type PokemonService_ListPokemonClient interface {
Recv() (*ListPokemonResponse, error)
grpc.ClientStream
}
type pokemonServiceListPokemonClient struct {
grpc.ClientStream
}
func (x *pokemonServiceListPokemonClient) Recv() (*ListPokemonResponse, error) {
m := new(ListPokemonResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// PokemonServiceServer is the server API for PokemonService service.
// All implementations must embed UnimplementedPokemonServiceServer
// for forward compatibility
type PokemonServiceServer interface {
CreatePokemon(context.Context, *CreatePokemonRequest) (*CreatePokemonResponse, error)
ReadPokemon(context.Context, *ReadPokemonRequest) (*ReadPokemonResponse, error)
UpdatePokemon(context.Context, *UpdatePokemonRequest) (*UpdatePokemonResponse, error)
DeletePokemon(context.Context, *DeletePokemonRequest) (*DeletePokemonResponse, error)
ListPokemon(*ListPokemonRequest, PokemonService_ListPokemonServer) error
mustEmbedUnimplementedPokemonServiceServer()
}
// UnimplementedPokemonServiceServer must be embedded to have forward compatible implementations.
type UnimplementedPokemonServiceServer struct {
}
func (UnimplementedPokemonServiceServer) CreatePokemon(context.Context, *CreatePokemonRequest) (*CreatePokemonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreatePokemon not implemented")
}
func (UnimplementedPokemonServiceServer) ReadPokemon(context.Context, *ReadPokemonRequest) (*ReadPokemonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadPokemon not implemented")
}
func (UnimplementedPokemonServiceServer) UpdatePokemon(context.Context, *UpdatePokemonRequest) (*UpdatePokemonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdatePokemon not implemented")
}
func (UnimplementedPokemonServiceServer) DeletePokemon(context.Context, *DeletePokemonRequest) (*DeletePokemonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeletePokemon not implemented")
}
func (UnimplementedPokemonServiceServer) ListPokemon(*ListPokemonRequest, PokemonService_ListPokemonServer) error {
return status.Errorf(codes.Unimplemented, "method ListPokemon not implemented")
}
func (UnimplementedPokemonServiceServer) mustEmbedUnimplementedPokemonServiceServer() {}
// UnsafePokemonServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PokemonServiceServer will
// result in compilation errors.
type UnsafePokemonServiceServer interface {
mustEmbedUnimplementedPokemonServiceServer()
}
func RegisterPokemonServiceServer(s grpc.ServiceRegistrar, srv PokemonServiceServer) {
s.RegisterService(&PokemonService_ServiceDesc, srv)
}
func _PokemonService_CreatePokemon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreatePokemonRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokemonServiceServer).CreatePokemon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pokemon.PokemonService/CreatePokemon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokemonServiceServer).CreatePokemon(ctx, req.(*CreatePokemonRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PokemonService_ReadPokemon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadPokemonRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokemonServiceServer).ReadPokemon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pokemon.PokemonService/ReadPokemon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokemonServiceServer).ReadPokemon(ctx, req.(*ReadPokemonRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PokemonService_UpdatePokemon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdatePokemonRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokemonServiceServer).UpdatePokemon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pokemon.PokemonService/UpdatePokemon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokemonServiceServer).UpdatePokemon(ctx, req.(*UpdatePokemonRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PokemonService_DeletePokemon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeletePokemonRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokemonServiceServer).DeletePokemon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pokemon.PokemonService/DeletePokemon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokemonServiceServer).DeletePokemon(ctx, req.(*DeletePokemonRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PokemonService_ListPokemon_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(ListPokemonRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(PokemonServiceServer).ListPokemon(m, &pokemonServiceListPokemonServer{stream})
}
type PokemonService_ListPokemonServer interface {
Send(*ListPokemonResponse) error
grpc.ServerStream
}
type pokemonServiceListPokemonServer struct {
grpc.ServerStream
}
func (x *pokemonServiceListPokemonServer) Send(m *ListPokemonResponse) error {
return x.ServerStream.SendMsg(m)
}
// PokemonService_ServiceDesc is the grpc.ServiceDesc for PokemonService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PokemonService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pokemon.PokemonService",
HandlerType: (*PokemonServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreatePokemon",
Handler: _PokemonService_CreatePokemon_Handler,
},
{
MethodName: "ReadPokemon",
Handler: _PokemonService_ReadPokemon_Handler,
},
{
MethodName: "UpdatePokemon",
Handler: _PokemonService_UpdatePokemon_Handler,
},
{
MethodName: "DeletePokemon",
Handler: _PokemonService_DeletePokemon_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "ListPokemon",
Handler: _PokemonService_ListPokemon_Handler,
ServerStreams: true,
},
},
Metadata: "pokemon/pokemon.proto",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment