book

package
v0.0.0-...-f698437 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package book is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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)

View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Book.ProtoReflect.Descriptor instead.

func (*Book) GetAbbr

func (x *Book) GetAbbr() *Lang

func (*Book) GetChapter

func (x *Book) GetChapter() int32

func (*Book) GetName

func (x *Book) GetName() *Lang

func (*Book) GetNumber

func (x *Book) GetNumber() int32

func (*Book) ProtoMessage

func (*Book) ProtoMessage()

func (*Book) ProtoReflect

func (x *Book) ProtoReflect() protoreflect.Message

func (*Book) Reset

func (x *Book) Reset()

func (*Book) String

func (x *Book) String() string

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.

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) Descriptor() ([]byte, []int)

Deprecated: Use Lang.ProtoReflect.Descriptor instead.

func (*Lang) GetEn

func (x *Lang) GetEn() string

func (*Lang) GetId

func (x *Lang) GetId() string

func (*Lang) ProtoMessage

func (*Lang) ProtoMessage()

func (*Lang) ProtoReflect

func (x *Lang) ProtoReflect() protoreflect.Message

func (*Lang) Reset

func (x *Lang) Reset()

func (*Lang) String

func (x *Lang) String() string

type UnimplementedBookServiceServer

type UnimplementedBookServiceServer struct {
}

UnimplementedBookServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedBookServiceServer) Book

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL