Documentation ¶
Overview ¶
Package book is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterBookServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterBookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookServiceClient) error
- func RegisterBookServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterBookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookServiceServer) error
- func RegisterBookServiceServer(s grpc.ServiceRegistrar, srv BookServiceServer)
- type Book
- func (*Book) Descriptor() ([]byte, []int)deprecated
- func (x *Book) GetAbbr() *Lang
- func (x *Book) GetChapter() int32
- func (x *Book) GetName() *Lang
- func (x *Book) GetNumber() int32
- func (*Book) ProtoMessage()
- func (x *Book) ProtoReflect() protoreflect.Message
- func (x *Book) Reset()
- func (x *Book) String() string
- type BookRequest
- type BookResponse
- type BookServiceClient
- type BookServiceServer
- type Lang
- type UnimplementedBookServiceServer
- type UnsafeBookServiceServer
Constants ¶
This section is empty.
Variables ¶
var BookService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "BookService", HandlerType: (*BookServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Book", Handler: _BookService_Book_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/book/book.proto", }
BookService_ServiceDesc is the grpc.ServiceDesc for BookService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_proto_book_book_proto protoreflect.FileDescriptor
Functions ¶
func RegisterBookServiceHandler ¶
func RegisterBookServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterBookServiceHandler registers the http handlers for service BookService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterBookServiceHandlerClient ¶
func RegisterBookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookServiceClient) error
RegisterBookServiceHandlerClient registers the http handlers for service BookService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BookServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BookServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BookServiceClient" to call the correct interceptors.
func RegisterBookServiceHandlerFromEndpoint ¶
func RegisterBookServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterBookServiceHandlerFromEndpoint is same as RegisterBookServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBookServiceHandlerServer ¶
func RegisterBookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookServiceServer) error
RegisterBookServiceHandlerServer registers the http handlers for service BookService to "mux". UnaryRPC :call BookServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBookServiceHandlerFromEndpoint instead.
func RegisterBookServiceServer ¶
func RegisterBookServiceServer(s grpc.ServiceRegistrar, srv BookServiceServer)
Types ¶
type Book ¶
type Book struct { Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` Abbr *Lang `protobuf:"bytes,2,opt,name=abbr,proto3" json:"abbr,omitempty"` Name *Lang `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Chapter int32 `protobuf:"varint,4,opt,name=chapter,proto3" json:"chapter,omitempty"` // contains filtered or unexported fields }
func (*Book) Descriptor
deprecated
func (*Book) GetChapter ¶
func (*Book) ProtoMessage ¶
func (*Book) ProtoMessage()
func (*Book) ProtoReflect ¶
func (x *Book) ProtoReflect() protoreflect.Message
type BookRequest ¶
type BookRequest struct {
// contains filtered or unexported fields
}
func (*BookRequest) Descriptor
deprecated
func (*BookRequest) Descriptor() ([]byte, []int)
Deprecated: Use BookRequest.ProtoReflect.Descriptor instead.
func (*BookRequest) ProtoMessage ¶
func (*BookRequest) ProtoMessage()
func (*BookRequest) ProtoReflect ¶
func (x *BookRequest) ProtoReflect() protoreflect.Message
func (*BookRequest) Reset ¶
func (x *BookRequest) Reset()
func (*BookRequest) String ¶
func (x *BookRequest) String() string
type BookResponse ¶
type BookResponse struct { Book []*Book `protobuf:"bytes,1,rep,name=book,proto3" json:"book,omitempty"` // contains filtered or unexported fields }
func (*BookResponse) Descriptor
deprecated
func (*BookResponse) Descriptor() ([]byte, []int)
Deprecated: Use BookResponse.ProtoReflect.Descriptor instead.
func (*BookResponse) GetBook ¶
func (x *BookResponse) GetBook() []*Book
func (*BookResponse) ProtoMessage ¶
func (*BookResponse) ProtoMessage()
func (*BookResponse) ProtoReflect ¶
func (x *BookResponse) ProtoReflect() protoreflect.Message
func (*BookResponse) Reset ¶
func (x *BookResponse) Reset()
func (*BookResponse) String ¶
func (x *BookResponse) String() string
type BookServiceClient ¶
type BookServiceClient interface {
Book(ctx context.Context, in *BookRequest, opts ...grpc.CallOption) (*BookResponse, error)
}
BookServiceClient is the client API for BookService 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.
func NewBookServiceClient ¶
func NewBookServiceClient(cc grpc.ClientConnInterface) BookServiceClient
type BookServiceServer ¶
type BookServiceServer interface { Book(context.Context, *BookRequest) (*BookResponse, error) // contains filtered or unexported methods }
BookServiceServer is the server API for BookService service. All implementations must embed UnimplementedBookServiceServer for forward compatibility
type Lang ¶
type Lang struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` En string `protobuf:"bytes,2,opt,name=en,proto3" json:"en,omitempty"` // contains filtered or unexported fields }
func (*Lang) Descriptor
deprecated
func (*Lang) ProtoMessage ¶
func (*Lang) ProtoMessage()
func (*Lang) ProtoReflect ¶
func (x *Lang) ProtoReflect() protoreflect.Message
type UnimplementedBookServiceServer ¶
type UnimplementedBookServiceServer struct { }
UnimplementedBookServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedBookServiceServer) Book ¶
func (UnimplementedBookServiceServer) Book(context.Context, *BookRequest) (*BookResponse, error)
type UnsafeBookServiceServer ¶
type UnsafeBookServiceServer interface {
// contains filtered or unexported methods
}
UnsafeBookServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BookServiceServer will result in compilation errors.