Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterBookDirHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterBookDirHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookDirClient) error
- func RegisterBookDirHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterBookDirHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookDirServer) error
- func RegisterBookDirServer(s grpc.ServiceRegistrar, srv BookDirServer)
- type Author
- func (*Author) Descriptor() ([]byte, []int)deprecated
- func (x *Author) GetAuthorID() uint32
- func (x *Author) GetBooksWritten() uint32
- func (x *Author) GetFirstName() string
- func (x *Author) GetLastName() string
- func (x *Author) GetMiddleName() string
- func (x *Author) GetYearBorn() uint32
- func (x *Author) GetYearDied() uint32
- func (*Author) ProtoMessage()
- func (x *Author) ProtoReflect() protoreflect.Message
- func (x *Author) Reset()
- func (x *Author) String() string
- type AuthorList
- type Book
- func (*Book) Descriptor() ([]byte, []int)deprecated
- func (x *Book) GetAuthor() *Author
- func (x *Book) GetCategory() string
- func (x *Book) GetEdition() uint32
- func (x *Book) GetISBN() string
- func (x *Book) GetOwned() bool
- func (x *Book) GetPDF() bool
- func (x *Book) GetPages() uint32
- func (x *Book) GetPublisher() *Publisher
- func (x *Book) GetTitle() string
- func (x *Book) GetYear() uint32
- func (*Book) ProtoMessage()
- func (x *Book) ProtoReflect() protoreflect.Message
- func (x *Book) Reset()
- func (x *Book) String() string
- type BookDirClient
- type BookDirServer
- type BookList
- type Empty
- type ISBN
- type Publisher
- func (*Publisher) Descriptor() ([]byte, []int)deprecated
- func (x *Publisher) GetBooksPublished() uint32
- func (x *Publisher) GetName() string
- func (x *Publisher) GetPublisherID() uint32
- func (x *Publisher) GetYearEnded() uint32
- func (x *Publisher) GetYearStarted() uint32
- func (*Publisher) ProtoMessage()
- func (x *Publisher) ProtoReflect() protoreflect.Message
- func (x *Publisher) Reset()
- func (x *Publisher) String() string
- type PublisherList
- type UnimplementedBookDirServer
- func (UnimplementedBookDirServer) AddBook(context.Context, *Book) (*Empty, error)
- func (UnimplementedBookDirServer) GetAllAuthors(context.Context, *Empty) (*AuthorList, error)
- func (UnimplementedBookDirServer) GetAllBooks(context.Context, *Empty) (*BookList, error)
- func (UnimplementedBookDirServer) GetAllPublishers(context.Context, *Empty) (*PublisherList, error)
- func (UnimplementedBookDirServer) GetAuthorById(context.Context, *Author) (*Author, error)
- func (UnimplementedBookDirServer) GetBookByISBN(context.Context, *ISBN) (*Book, error)
- func (UnimplementedBookDirServer) GetBooksByAuthor(context.Context, *Author) (*BookList, error)
- func (UnimplementedBookDirServer) GetBooksByPublisher(context.Context, *Publisher) (*BookList, error)
- type UnsafeBookDirServer
Constants ¶
This section is empty.
Variables ¶
var BookDir_ServiceDesc = grpc.ServiceDesc{ ServiceName: "bookdir.v1.BookDir", HandlerType: (*BookDirServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetAllPublishers", Handler: _BookDir_GetAllPublishers_Handler, }, { MethodName: "GetBooksByPublisher", Handler: _BookDir_GetBooksByPublisher_Handler, }, { MethodName: "GetAllAuthors", Handler: _BookDir_GetAllAuthors_Handler, }, { MethodName: "GetAuthorById", Handler: _BookDir_GetAuthorById_Handler, }, { MethodName: "GetBooksByAuthor", Handler: _BookDir_GetBooksByAuthor_Handler, }, { MethodName: "GetAllBooks", Handler: _BookDir_GetAllBooks_Handler, }, { MethodName: "GetBookByISBN", Handler: _BookDir_GetBookByISBN_Handler, }, { MethodName: "AddBook", Handler: _BookDir_AddBook_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "v1/bookdir.proto", }
BookDir_ServiceDesc is the grpc.ServiceDesc for BookDir service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_v1_bookdir_proto protoreflect.FileDescriptor
Functions ¶
func RegisterBookDirHandler ¶
func RegisterBookDirHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterBookDirHandler registers the http handlers for service BookDir to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterBookDirHandlerClient ¶
func RegisterBookDirHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookDirClient) error
RegisterBookDirHandlerClient registers the http handlers for service BookDir to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BookDirClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BookDirClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BookDirClient" to call the correct interceptors.
func RegisterBookDirHandlerFromEndpoint ¶
func RegisterBookDirHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterBookDirHandlerFromEndpoint is same as RegisterBookDirHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBookDirHandlerServer ¶
func RegisterBookDirHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookDirServer) error
RegisterBookDirHandlerServer registers the http handlers for service BookDir to "mux". UnaryRPC :call BookDirServer 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 RegisterBookDirHandlerFromEndpoint instead.
func RegisterBookDirServer ¶
func RegisterBookDirServer(s grpc.ServiceRegistrar, srv BookDirServer)
Types ¶
type Author ¶
type Author struct { AuthorID uint32 `protobuf:"varint,1,opt,name=AuthorID,proto3" json:"AuthorID,omitempty"` FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` MiddleName string `protobuf:"bytes,3,opt,name=MiddleName,proto3" json:"MiddleName,omitempty"` LastName string `protobuf:"bytes,4,opt,name=LastName,proto3" json:"LastName,omitempty"` YearBorn uint32 `protobuf:"varint,5,opt,name=YearBorn,proto3" json:"YearBorn,omitempty"` YearDied uint32 `protobuf:"varint,6,opt,name=YearDied,proto3" json:"YearDied,omitempty"` BooksWritten uint32 `protobuf:"varint,7,opt,name=BooksWritten,proto3" json:"BooksWritten,omitempty"` // contains filtered or unexported fields }
func (*Author) Descriptor
deprecated
func (*Author) GetAuthorID ¶
func (*Author) GetBooksWritten ¶
func (*Author) GetFirstName ¶
func (*Author) GetLastName ¶
func (*Author) GetMiddleName ¶
func (*Author) GetYearBorn ¶
func (*Author) GetYearDied ¶
func (*Author) ProtoMessage ¶
func (*Author) ProtoMessage()
func (*Author) ProtoReflect ¶
func (x *Author) ProtoReflect() protoreflect.Message
type AuthorList ¶
type AuthorList struct { Authors []*Author `protobuf:"bytes,1,rep,name=authors,proto3" json:"authors,omitempty"` // contains filtered or unexported fields }
func (*AuthorList) Descriptor
deprecated
func (*AuthorList) Descriptor() ([]byte, []int)
Deprecated: Use AuthorList.ProtoReflect.Descriptor instead.
func (*AuthorList) GetAuthors ¶
func (x *AuthorList) GetAuthors() []*Author
func (*AuthorList) ProtoMessage ¶
func (*AuthorList) ProtoMessage()
func (*AuthorList) ProtoReflect ¶
func (x *AuthorList) ProtoReflect() protoreflect.Message
func (*AuthorList) Reset ¶
func (x *AuthorList) Reset()
func (*AuthorList) String ¶
func (x *AuthorList) String() string
type Book ¶
type Book struct { ISBN string `protobuf:"bytes,1,opt,name=ISBN,proto3" json:"ISBN,omitempty"` Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` Author *Author `protobuf:"bytes,3,opt,name=Author,proto3" json:"Author,omitempty"` Year uint32 `protobuf:"varint,4,opt,name=Year,proto3" json:"Year,omitempty"` Edition uint32 `protobuf:"varint,5,opt,name=Edition,proto3" json:"Edition,omitempty"` Publisher *Publisher `protobuf:"bytes,6,opt,name=Publisher,proto3" json:"Publisher,omitempty"` Pages uint32 `protobuf:"varint,7,opt,name=Pages,proto3" json:"Pages,omitempty"` Category string `protobuf:"bytes,8,opt,name=Category,proto3" json:"Category,omitempty"` PDF bool `protobuf:"varint,9,opt,name=PDF,proto3" json:"PDF,omitempty"` Owned bool `protobuf:"varint,10,opt,name=Owned,proto3" json:"Owned,omitempty"` // contains filtered or unexported fields }
func (*Book) Descriptor
deprecated
func (*Book) GetCategory ¶
func (*Book) GetEdition ¶
func (*Book) GetPublisher ¶
func (*Book) ProtoMessage ¶
func (*Book) ProtoMessage()
func (*Book) ProtoReflect ¶
func (x *Book) ProtoReflect() protoreflect.Message
type BookDirClient ¶
type BookDirClient interface { GetAllPublishers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PublisherList, error) GetBooksByPublisher(ctx context.Context, in *Publisher, opts ...grpc.CallOption) (*BookList, error) GetAllAuthors(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*AuthorList, error) GetAuthorById(ctx context.Context, in *Author, opts ...grpc.CallOption) (*Author, error) GetBooksByAuthor(ctx context.Context, in *Author, opts ...grpc.CallOption) (*BookList, error) GetAllBooks(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BookList, error) GetBookByISBN(ctx context.Context, in *ISBN, opts ...grpc.CallOption) (*Book, error) AddBook(ctx context.Context, in *Book, opts ...grpc.CallOption) (*Empty, error) }
BookDirClient is the client API for BookDir 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 NewBookDirClient ¶
func NewBookDirClient(cc grpc.ClientConnInterface) BookDirClient
type BookDirServer ¶
type BookDirServer interface { GetAllPublishers(context.Context, *Empty) (*PublisherList, error) GetBooksByPublisher(context.Context, *Publisher) (*BookList, error) GetAllAuthors(context.Context, *Empty) (*AuthorList, error) GetAuthorById(context.Context, *Author) (*Author, error) GetBooksByAuthor(context.Context, *Author) (*BookList, error) GetAllBooks(context.Context, *Empty) (*BookList, error) GetBookByISBN(context.Context, *ISBN) (*Book, error) AddBook(context.Context, *Book) (*Empty, error) // contains filtered or unexported methods }
BookDirServer is the server API for BookDir service. All implementations must embed UnimplementedBookDirServer for forward compatibility
type BookList ¶
type BookList struct { Books []*Book `protobuf:"bytes,1,rep,name=books,proto3" json:"books,omitempty"` // contains filtered or unexported fields }
func (*BookList) Descriptor
deprecated
func (*BookList) ProtoMessage ¶
func (*BookList) ProtoMessage()
func (*BookList) ProtoReflect ¶
func (x *BookList) ProtoReflect() protoreflect.Message
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type ISBN ¶
type ISBN struct { ISBN string `protobuf:"bytes,1,opt,name=ISBN,proto3" json:"ISBN,omitempty"` // contains filtered or unexported fields }
func (*ISBN) Descriptor
deprecated
func (*ISBN) ProtoMessage ¶
func (*ISBN) ProtoMessage()
func (*ISBN) ProtoReflect ¶
func (x *ISBN) ProtoReflect() protoreflect.Message
type Publisher ¶
type Publisher struct { PublisherID uint32 `protobuf:"varint,1,opt,name=PublisherID,proto3" json:"PublisherID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` YearStarted uint32 `protobuf:"varint,3,opt,name=YearStarted,proto3" json:"YearStarted,omitempty"` YearEnded uint32 `protobuf:"varint,4,opt,name=YearEnded,proto3" json:"YearEnded,omitempty"` BooksPublished uint32 `protobuf:"varint,5,opt,name=BooksPublished,proto3" json:"BooksPublished,omitempty"` // contains filtered or unexported fields }
func (*Publisher) Descriptor
deprecated
func (*Publisher) GetBooksPublished ¶
func (*Publisher) GetPublisherID ¶
func (*Publisher) GetYearEnded ¶
func (*Publisher) GetYearStarted ¶
func (*Publisher) ProtoMessage ¶
func (*Publisher) ProtoMessage()
func (*Publisher) ProtoReflect ¶
func (x *Publisher) ProtoReflect() protoreflect.Message
type PublisherList ¶
type PublisherList struct { Publishers []*Publisher `protobuf:"bytes,1,rep,name=publishers,proto3" json:"publishers,omitempty"` // contains filtered or unexported fields }
func (*PublisherList) Descriptor
deprecated
func (*PublisherList) Descriptor() ([]byte, []int)
Deprecated: Use PublisherList.ProtoReflect.Descriptor instead.
func (*PublisherList) GetPublishers ¶
func (x *PublisherList) GetPublishers() []*Publisher
func (*PublisherList) ProtoMessage ¶
func (*PublisherList) ProtoMessage()
func (*PublisherList) ProtoReflect ¶
func (x *PublisherList) ProtoReflect() protoreflect.Message
func (*PublisherList) Reset ¶
func (x *PublisherList) Reset()
func (*PublisherList) String ¶
func (x *PublisherList) String() string
type UnimplementedBookDirServer ¶
type UnimplementedBookDirServer struct { }
UnimplementedBookDirServer must be embedded to have forward compatible implementations.
func (UnimplementedBookDirServer) GetAllAuthors ¶
func (UnimplementedBookDirServer) GetAllAuthors(context.Context, *Empty) (*AuthorList, error)
func (UnimplementedBookDirServer) GetAllBooks ¶
func (UnimplementedBookDirServer) GetAllPublishers ¶
func (UnimplementedBookDirServer) GetAllPublishers(context.Context, *Empty) (*PublisherList, error)
func (UnimplementedBookDirServer) GetAuthorById ¶
func (UnimplementedBookDirServer) GetBookByISBN ¶
func (UnimplementedBookDirServer) GetBooksByAuthor ¶
func (UnimplementedBookDirServer) GetBooksByPublisher ¶
type UnsafeBookDirServer ¶
type UnsafeBookDirServer interface {
// contains filtered or unexported methods
}
UnsafeBookDirServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BookDirServer will result in compilation errors.