library

package
v0.0.0-...-9a2beb2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: MIT Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var BookType_name = map[int]string{
	0: "HARDCOVER",
	1: "PAPERBACK",
	2: "AUDIOBOOK",
}
View Source
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) GetAuthor

func (m *Book) GetAuthor() (x string)

GetAuthor gets the Author of the Book.

func (*Book) GetBookType

func (m *Book) GetBookType() (x BookType)

GetBookType gets the BookType of the Book.

func (*Book) GetIsbn

func (m *Book) GetIsbn() (x int64)

GetIsbn gets the Isbn of the Book.

func (*Book) GetPublicationDate

func (m *Book) GetPublicationDate() (x *google_protobuf.Timestamp)

GetPublicationDate gets the PublicationDate of the Book.

func (*Book) GetPublisher

func (m *Book) GetPublisher() (x *Publisher)

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

func (m *Book) GetSelfPublished() (x bool)

GetSelfPublished gets the SelfPublished of the Book.

func (*Book) GetTitle

func (m *Book) GetTitle() (x string)

GetTitle gets the Title of the Book.

func (*Book) Marshal

func (m *Book) Marshal() []byte

Marshal marshals Book to a slice of bytes.

func (*Book) MarshalToWriter

func (m *Book) MarshalToWriter(writer jspb.Writer)

MarshalToWriter marshals Book to the provided writer.

func (*Book) Unmarshal

func (m *Book) Unmarshal(rawBytes []byte) (*Book, error)

Unmarshal unmarshals a Book from a slice of bytes.

func (*Book) UnmarshalFromReader

func (m *Book) UnmarshalFromReader(reader jspb.Reader) *Book

UnmarshalFromReader unmarshals a Book from the provided reader.

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.

const (
	// Hardcover is a book with a hard back.
	BookType_HARDCOVER BookType = 0
	// Paperback is a book with a soft back.
	BookType_PAPERBACK BookType = 1
	// Audiobook is an audio recording of the book.
	BookType_AUDIOBOOK BookType = 2
)

func (BookType) String

func (x BookType) String() string

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) GetName

func (m *Publisher) GetName() (x string)

GetName gets the Name of the Publisher.

func (*Publisher) Marshal

func (m *Publisher) Marshal() []byte

Marshal marshals Publisher to a slice of bytes.

func (*Publisher) MarshalToWriter

func (m *Publisher) MarshalToWriter(writer jspb.Writer)

MarshalToWriter marshals Publisher to the provided writer.

func (*Publisher) Unmarshal

func (m *Publisher) Unmarshal(rawBytes []byte) (*Publisher, error)

Unmarshal unmarshals a Publisher from a slice of bytes.

func (*Publisher) UnmarshalFromReader

func (m *Publisher) UnmarshalFromReader(reader jspb.Reader) *Publisher

UnmarshalFromReader unmarshals a Publisher from the provided reader.

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.

Jump to

Keyboard shortcuts

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