v1

package
v0.0.0-...-f016e46 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

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

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

Deprecated: Use Author.ProtoReflect.Descriptor instead.

func (*Author) GetAuthorID

func (x *Author) GetAuthorID() uint32

func (*Author) GetBooksWritten

func (x *Author) GetBooksWritten() uint32

func (*Author) GetFirstName

func (x *Author) GetFirstName() string

func (*Author) GetLastName

func (x *Author) GetLastName() string

func (*Author) GetMiddleName

func (x *Author) GetMiddleName() string

func (*Author) GetYearBorn

func (x *Author) GetYearBorn() uint32

func (*Author) GetYearDied

func (x *Author) GetYearDied() uint32

func (*Author) ProtoMessage

func (*Author) ProtoMessage()

func (*Author) ProtoReflect

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

func (*Author) Reset

func (x *Author) Reset()

func (*Author) String

func (x *Author) String() string

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

Deprecated: Use Book.ProtoReflect.Descriptor instead.

func (*Book) GetAuthor

func (x *Book) GetAuthor() *Author

func (*Book) GetCategory

func (x *Book) GetCategory() string

func (*Book) GetEdition

func (x *Book) GetEdition() uint32

func (*Book) GetISBN

func (x *Book) GetISBN() string

func (*Book) GetOwned

func (x *Book) GetOwned() bool

func (*Book) GetPDF

func (x *Book) GetPDF() bool

func (*Book) GetPages

func (x *Book) GetPages() uint32

func (*Book) GetPublisher

func (x *Book) GetPublisher() *Publisher

func (*Book) GetTitle

func (x *Book) GetTitle() string

func (*Book) GetYear

func (x *Book) GetYear() uint32

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

Deprecated: Use BookList.ProtoReflect.Descriptor instead.

func (*BookList) GetBooks

func (x *BookList) GetBooks() []*Book

func (*BookList) ProtoMessage

func (*BookList) ProtoMessage()

func (*BookList) ProtoReflect

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

func (*BookList) Reset

func (x *BookList) Reset()

func (*BookList) String

func (x *BookList) String() string

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

func (*Empty) Descriptor deprecated

func (*Empty) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

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

Deprecated: Use ISBN.ProtoReflect.Descriptor instead.

func (*ISBN) GetISBN

func (x *ISBN) GetISBN() string

func (*ISBN) ProtoMessage

func (*ISBN) ProtoMessage()

func (*ISBN) ProtoReflect

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

func (*ISBN) Reset

func (x *ISBN) Reset()

func (*ISBN) String

func (x *ISBN) String() string

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

Deprecated: Use Publisher.ProtoReflect.Descriptor instead.

func (*Publisher) GetBooksPublished

func (x *Publisher) GetBooksPublished() uint32

func (*Publisher) GetName

func (x *Publisher) GetName() string

func (*Publisher) GetPublisherID

func (x *Publisher) GetPublisherID() uint32

func (*Publisher) GetYearEnded

func (x *Publisher) GetYearEnded() uint32

func (*Publisher) GetYearStarted

func (x *Publisher) GetYearStarted() uint32

func (*Publisher) ProtoMessage

func (*Publisher) ProtoMessage()

func (*Publisher) ProtoReflect

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

func (*Publisher) Reset

func (x *Publisher) Reset()

func (*Publisher) String

func (x *Publisher) String() string

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

func (UnimplementedBookDirServer) GetAllAuthors

func (UnimplementedBookDirServer) GetAllBooks

func (UnimplementedBookDirServer) GetAllPublishers

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.

Jump to

Keyboard shortcuts

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