github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/examples/library/apipb/library_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  
     3  package apipb
     4  
     5  import (
     6  	context "context"
     7  	grpc "google.golang.org/grpc"
     8  	codes "google.golang.org/grpc/codes"
     9  	status "google.golang.org/grpc/status"
    10  )
    11  
    12  // This is a compile-time assertion to ensure that this generated file
    13  // is compatible with the grpc package it is being compiled against.
    14  // Requires gRPC-Go v1.32.0 or later.
    15  const _ = grpc.SupportPackageIsVersion7
    16  
    17  // LibraryClient is the client API for Library service.
    18  //
    19  // 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.
    20  type LibraryClient interface {
    21  	GetBook(ctx context.Context, in *GetBookRequest, opts ...grpc.CallOption) (*Book, error)
    22  	CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error)
    23  }
    24  
    25  type libraryClient struct {
    26  	cc grpc.ClientConnInterface
    27  }
    28  
    29  func NewLibraryClient(cc grpc.ClientConnInterface) LibraryClient {
    30  	return &libraryClient{cc}
    31  }
    32  
    33  func (c *libraryClient) GetBook(ctx context.Context, in *GetBookRequest, opts ...grpc.CallOption) (*Book, error) {
    34  	out := new(Book)
    35  	err := c.cc.Invoke(ctx, "/larking.examples.library.Library/GetBook", in, out, opts...)
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  	return out, nil
    40  }
    41  
    42  func (c *libraryClient) CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) {
    43  	out := new(Book)
    44  	err := c.cc.Invoke(ctx, "/larking.examples.library.Library/CreateBook", in, out, opts...)
    45  	if err != nil {
    46  		return nil, err
    47  	}
    48  	return out, nil
    49  }
    50  
    51  // LibraryServer is the server API for Library service.
    52  // All implementations must embed UnimplementedLibraryServer
    53  // for forward compatibility
    54  type LibraryServer interface {
    55  	GetBook(context.Context, *GetBookRequest) (*Book, error)
    56  	CreateBook(context.Context, *CreateBookRequest) (*Book, error)
    57  	mustEmbedUnimplementedLibraryServer()
    58  }
    59  
    60  // UnimplementedLibraryServer must be embedded to have forward compatible implementations.
    61  type UnimplementedLibraryServer struct {
    62  }
    63  
    64  func (UnimplementedLibraryServer) GetBook(context.Context, *GetBookRequest) (*Book, error) {
    65  	return nil, status.Errorf(codes.Unimplemented, "method GetBook not implemented")
    66  }
    67  func (UnimplementedLibraryServer) CreateBook(context.Context, *CreateBookRequest) (*Book, error) {
    68  	return nil, status.Errorf(codes.Unimplemented, "method CreateBook not implemented")
    69  }
    70  func (UnimplementedLibraryServer) mustEmbedUnimplementedLibraryServer() {}
    71  
    72  // UnsafeLibraryServer may be embedded to opt out of forward compatibility for this service.
    73  // Use of this interface is not recommended, as added methods to LibraryServer will
    74  // result in compilation errors.
    75  type UnsafeLibraryServer interface {
    76  	mustEmbedUnimplementedLibraryServer()
    77  }
    78  
    79  func RegisterLibraryServer(s grpc.ServiceRegistrar, srv LibraryServer) {
    80  	s.RegisterService(&Library_ServiceDesc, srv)
    81  }
    82  
    83  func _Library_GetBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
    84  	in := new(GetBookRequest)
    85  	if err := dec(in); err != nil {
    86  		return nil, err
    87  	}
    88  	if interceptor == nil {
    89  		return srv.(LibraryServer).GetBook(ctx, in)
    90  	}
    91  	info := &grpc.UnaryServerInfo{
    92  		Server:     srv,
    93  		FullMethod: "/larking.examples.library.Library/GetBook",
    94  	}
    95  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
    96  		return srv.(LibraryServer).GetBook(ctx, req.(*GetBookRequest))
    97  	}
    98  	return interceptor(ctx, in, info, handler)
    99  }
   100  
   101  func _Library_CreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   102  	in := new(CreateBookRequest)
   103  	if err := dec(in); err != nil {
   104  		return nil, err
   105  	}
   106  	if interceptor == nil {
   107  		return srv.(LibraryServer).CreateBook(ctx, in)
   108  	}
   109  	info := &grpc.UnaryServerInfo{
   110  		Server:     srv,
   111  		FullMethod: "/larking.examples.library.Library/CreateBook",
   112  	}
   113  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   114  		return srv.(LibraryServer).CreateBook(ctx, req.(*CreateBookRequest))
   115  	}
   116  	return interceptor(ctx, in, info, handler)
   117  }
   118  
   119  // Library_ServiceDesc is the grpc.ServiceDesc for Library service.
   120  // It's only intended for direct use with grpc.RegisterService,
   121  // and not to be introspected or modified (even as a copy)
   122  var Library_ServiceDesc = grpc.ServiceDesc{
   123  	ServiceName: "larking.examples.library.Library",
   124  	HandlerType: (*LibraryServer)(nil),
   125  	Methods: []grpc.MethodDesc{
   126  		{
   127  			MethodName: "GetBook",
   128  			Handler:    _Library_GetBook_Handler,
   129  		},
   130  		{
   131  			MethodName: "CreateBook",
   132  			Handler:    _Library_CreateBook_Handler,
   133  		},
   134  	},
   135  	Streams:  []grpc.StreamDesc{},
   136  	Metadata: "apipb/library.proto",
   137  }