Documentation ¶
Overview ¶
Package library is a generated protocol buffer package.
Package library exposes a list of books over a gRPC API.
It is generated from these files:
proto/library/book_service.proto
It has these top-level messages:
Publisher Book GetBookRequest QueryBooksRequest Collection BookMessage BookResponse
Index ¶
- Variables
- type Book
- func (m *Book) GetAuthor() (x string)
- func (m *Book) GetBookType() (x BookType)
- func (m *Book) GetIsbn() (x int64)
- func (m *Book) GetPublicationDate() (x *google_protobuf.Timestamp)
- func (m *Book) GetPublisher() (x *Publisher)
- func (m *Book) GetPublishingMethod() (x isBook_PublishingMethod)
- func (m *Book) GetSelfPublished() (x bool)
- func (m *Book) GetTitle() (x string)
- func (m *Book) Marshal() []byte
- func (m *Book) MarshalToWriter(writer jspb.Writer)
- func (m *Book) Unmarshal(rawBytes []byte) (*Book, error)
- func (m *Book) UnmarshalFromReader(reader jspb.Reader) *Book
- type BookMessage
- func (m *BookMessage) GetContent() (x isBookMessage_Content)
- func (m *BookMessage) GetMessage() (x string)
- func (m *BookMessage) GetName() (x string)
- func (m *BookMessage) Marshal() []byte
- func (m *BookMessage) MarshalToWriter(writer jspb.Writer)
- func (m *BookMessage) Unmarshal(rawBytes []byte) (*BookMessage, error)
- func (m *BookMessage) UnmarshalFromReader(reader jspb.Reader) *BookMessage
- type BookMessage_Message
- type BookMessage_Name
- type BookResponse
- type BookServiceClient
- type BookService_BookChatClient
- type BookService_MakeCollectionClient
- type BookService_QueryBooksClient
- type BookType
- type Book_Publisher
- type Book_SelfPublished
- type Collection
- type GetBookRequest
- func (m *GetBookRequest) GetIsbn() (x int64)
- func (m *GetBookRequest) Marshal() []byte
- func (m *GetBookRequest) MarshalToWriter(writer jspb.Writer)
- func (m *GetBookRequest) Unmarshal(rawBytes []byte) (*GetBookRequest, error)
- func (m *GetBookRequest) UnmarshalFromReader(reader jspb.Reader) *GetBookRequest
- type Publisher
- type QueryBooksRequest
- func (m *QueryBooksRequest) GetAuthorPrefix() (x string)
- func (m *QueryBooksRequest) Marshal() []byte
- func (m *QueryBooksRequest) MarshalToWriter(writer jspb.Writer)
- func (m *QueryBooksRequest) Unmarshal(rawBytes []byte) (*QueryBooksRequest, error)
- func (m *QueryBooksRequest) UnmarshalFromReader(reader jspb.Reader) *QueryBooksRequest
Constants ¶
This section is empty.
Variables ¶
var BookType_name = map[int]string{
0: "HARDCOVER",
1: "PAPERBACK",
2: "AUDIOBOOK",
}
var BookType_value = map[string]int{
"HARDCOVER": 0,
"PAPERBACK": 1,
"AUDIOBOOK": 2,
}
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct { // Isbn is the ISBN number of the book. Isbn int64 // Title is the title of the book. Title string // Author is the author of the book. Author string // BookType is the type of the book. BookType BookType // PublishingMethod is the publishing method // used for this Book. // // Types that are valid to be assigned to PublishingMethod: // *Book_SelfPublished // *Book_Publisher PublishingMethod isBook_PublishingMethod // PublicationDate is the time of publication of the book. PublicationDate *google_protobuf.Timestamp }
Book represents a book in the library.
func (*Book) GetBookType ¶
GetBookType gets the BookType of the Book.
func (*Book) GetPublicationDate ¶
func (m *Book) GetPublicationDate() (x *google_protobuf.Timestamp)
GetPublicationDate gets the PublicationDate of the Book.
func (*Book) GetPublisher ¶
GetPublisher gets the Publisher of the Book.
func (*Book) GetPublishingMethod ¶
func (m *Book) GetPublishingMethod() (x isBook_PublishingMethod)
GetPublishingMethod gets the PublishingMethod of the Book.
func (*Book) GetSelfPublished ¶
GetSelfPublished gets the SelfPublished of the Book.
func (*Book) MarshalToWriter ¶
MarshalToWriter marshals Book to the provided writer.
type BookMessage ¶
type BookMessage struct { // Types that are valid to be assigned to Content: // *BookMessage_Name // *BookMessage_Message Content isBookMessage_Content }
BookMessage is used to discuss books
func (*BookMessage) GetContent ¶
func (m *BookMessage) GetContent() (x isBookMessage_Content)
GetContent gets the Content of the BookMessage.
func (*BookMessage) GetMessage ¶
func (m *BookMessage) GetMessage() (x string)
GetMessage gets the Message of the BookMessage.
func (*BookMessage) GetName ¶
func (m *BookMessage) GetName() (x string)
GetName gets the Name of the BookMessage.
func (*BookMessage) Marshal ¶
func (m *BookMessage) Marshal() []byte
Marshal marshals BookMessage to a slice of bytes.
func (*BookMessage) MarshalToWriter ¶
func (m *BookMessage) MarshalToWriter(writer jspb.Writer)
MarshalToWriter marshals BookMessage to the provided writer.
func (*BookMessage) Unmarshal ¶
func (m *BookMessage) Unmarshal(rawBytes []byte) (*BookMessage, error)
Unmarshal unmarshals a BookMessage from a slice of bytes.
func (*BookMessage) UnmarshalFromReader ¶
func (m *BookMessage) UnmarshalFromReader(reader jspb.Reader) *BookMessage
UnmarshalFromReader unmarshals a BookMessage from the provided reader.
type BookMessage_Message ¶
type BookMessage_Message struct { // Message is any message the user wishes to send. Message string }
BookMessage_Message is assignable to Content
type BookMessage_Name ¶
type BookMessage_Name struct { // Name is the name of the person who is sending this message. // It should be sent as the first message on the stream. Name string }
BookMessage_Name is assignable to Content
type BookResponse ¶
type BookResponse struct { // Message is a message from a user. Message string }
BookResponse is used to discuss books
func (*BookResponse) GetMessage ¶
func (m *BookResponse) GetMessage() (x string)
GetMessage gets the Message of the BookResponse.
func (*BookResponse) Marshal ¶
func (m *BookResponse) Marshal() []byte
Marshal marshals BookResponse to a slice of bytes.
func (*BookResponse) MarshalToWriter ¶
func (m *BookResponse) MarshalToWriter(writer jspb.Writer)
MarshalToWriter marshals BookResponse to the provided writer.
func (*BookResponse) Unmarshal ¶
func (m *BookResponse) Unmarshal(rawBytes []byte) (*BookResponse, error)
Unmarshal unmarshals a BookResponse from a slice of bytes.
func (*BookResponse) UnmarshalFromReader ¶
func (m *BookResponse) UnmarshalFromReader(reader jspb.Reader) *BookResponse
UnmarshalFromReader unmarshals a BookResponse from the provided reader.
type BookServiceClient ¶
type BookServiceClient interface { // GetBook returns a Book from the library // that matches the ISBN provided, if found. // Otherwise it returns a NotFound error. GetBook(ctx context.Context, in *GetBookRequest, opts ...grpcweb.CallOption) (*Book, error) // QueryBooks returns all Books whos author // matches the author prefix provided, as a stream // of Books. QueryBooks(ctx context.Context, in *QueryBooksRequest, opts ...grpcweb.CallOption) (BookService_QueryBooksClient, error) // MakeCollection takes a stream of books and returns a Book collection. MakeCollection(ctx context.Context, opts ...grpcweb.CallOption) (BookService_MakeCollectionClient, error) // BookChat allows discussion about books BookChat(ctx context.Context, opts ...grpcweb.CallOption) (BookService_BookChatClient, error) }
BookService exposes GetBook and QueryBooks, which allow querying of the library.
func NewBookServiceClient ¶
func NewBookServiceClient(hostname string, opts ...grpcweb.DialOption) BookServiceClient
NewBookServiceClient creates a new gRPC-Web client.
type BookService_BookChatClient ¶
type BookService_BookChatClient interface { Send(*BookMessage) error Recv() (*BookResponse, error) grpcweb.ClientStream }
type BookService_MakeCollectionClient ¶
type BookService_MakeCollectionClient interface { Send(*Book) error CloseAndRecv() (*Collection, error) grpcweb.ClientStream }
type BookService_QueryBooksClient ¶
type BookService_QueryBooksClient interface { Recv() (*Book, error) grpcweb.ClientStream }
type BookType ¶
type BookType int
BookType describes the different types a book in the library can be.
type Book_Publisher ¶
type Book_Publisher struct { // Publisher means this book was published // through a Publisher. Publisher *Publisher }
Book_Publisher is assignable to PublishingMethod
type Book_SelfPublished ¶
type Book_SelfPublished struct { // SelfPublished means this book was // self published. SelfPublished bool }
Book_SelfPublished is assignable to PublishingMethod
type Collection ¶
type Collection struct { // Books is a list of books Books []*Book }
Collection is a collection of books
func (*Collection) GetBooks ¶
func (m *Collection) GetBooks() (x []*Book)
GetBooks gets the Books of the Collection.
func (*Collection) Marshal ¶
func (m *Collection) Marshal() []byte
Marshal marshals Collection to a slice of bytes.
func (*Collection) MarshalToWriter ¶
func (m *Collection) MarshalToWriter(writer jspb.Writer)
MarshalToWriter marshals Collection to the provided writer.
func (*Collection) Unmarshal ¶
func (m *Collection) Unmarshal(rawBytes []byte) (*Collection, error)
Unmarshal unmarshals a Collection from a slice of bytes.
func (*Collection) UnmarshalFromReader ¶
func (m *Collection) UnmarshalFromReader(reader jspb.Reader) *Collection
UnmarshalFromReader unmarshals a Collection from the provided reader.
type GetBookRequest ¶
type GetBookRequest struct { // Isbn is the ISBN with which // to match against the ISBN of a book in the library. Isbn int64 }
GetBookRequest is the input to the GetBook method.
func (*GetBookRequest) GetIsbn ¶
func (m *GetBookRequest) GetIsbn() (x int64)
GetIsbn gets the Isbn of the GetBookRequest.
func (*GetBookRequest) Marshal ¶
func (m *GetBookRequest) Marshal() []byte
Marshal marshals GetBookRequest to a slice of bytes.
func (*GetBookRequest) MarshalToWriter ¶
func (m *GetBookRequest) MarshalToWriter(writer jspb.Writer)
MarshalToWriter marshals GetBookRequest to the provided writer.
func (*GetBookRequest) Unmarshal ¶
func (m *GetBookRequest) Unmarshal(rawBytes []byte) (*GetBookRequest, error)
Unmarshal unmarshals a GetBookRequest from a slice of bytes.
func (*GetBookRequest) UnmarshalFromReader ¶
func (m *GetBookRequest) UnmarshalFromReader(reader jspb.Reader) *GetBookRequest
UnmarshalFromReader unmarshals a GetBookRequest from the provided reader.
type Publisher ¶
type Publisher struct { // Name is the name of the Publisher. Name string }
Publisher describes a Book Publisher.
func (*Publisher) MarshalToWriter ¶
MarshalToWriter marshals Publisher to the provided writer.
type QueryBooksRequest ¶
type QueryBooksRequest struct { // AuthorPrefix is the prefix with which // to match against the author of a book in the library. AuthorPrefix string }
QueryBooksRequest is the input to the QueryBooks method.
func (*QueryBooksRequest) GetAuthorPrefix ¶
func (m *QueryBooksRequest) GetAuthorPrefix() (x string)
GetAuthorPrefix gets the AuthorPrefix of the QueryBooksRequest.
func (*QueryBooksRequest) Marshal ¶
func (m *QueryBooksRequest) Marshal() []byte
Marshal marshals QueryBooksRequest to a slice of bytes.
func (*QueryBooksRequest) MarshalToWriter ¶
func (m *QueryBooksRequest) MarshalToWriter(writer jspb.Writer)
MarshalToWriter marshals QueryBooksRequest to the provided writer.
func (*QueryBooksRequest) Unmarshal ¶
func (m *QueryBooksRequest) Unmarshal(rawBytes []byte) (*QueryBooksRequest, error)
Unmarshal unmarshals a QueryBooksRequest from a slice of bytes.
func (*QueryBooksRequest) UnmarshalFromReader ¶
func (m *QueryBooksRequest) UnmarshalFromReader(reader jspb.Reader) *QueryBooksRequest
UnmarshalFromReader unmarshals a QueryBooksRequest from the provided reader.