bookstore

package
v0.0.0-...-2c1eb2d Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package bookstore is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var BookStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "BookStore",
	HandlerType: (*BookStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateBook",
			Handler:    _BookStore_CreateBook_Handler,
		},
		{
			MethodName: "ReadBook",
			Handler:    _BookStore_ReadBook_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service.proto",
}

BookStore_ServiceDesc is the grpc.ServiceDesc for BookStore 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_service_proto protoreflect.FileDescriptor

Functions

func RegisterBookStoreHandler

func RegisterBookStoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterBookStoreHandler registers the http handlers for service BookStore to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterBookStoreHandlerClient

func RegisterBookStoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookStoreClient) error

RegisterBookStoreHandlerClient registers the http handlers for service BookStore to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BookStoreClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BookStoreClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BookStoreClient" to call the correct interceptors.

func RegisterBookStoreHandlerFromEndpoint

func RegisterBookStoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterBookStoreHandlerFromEndpoint is same as RegisterBookStoreHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterBookStoreHandlerServer

func RegisterBookStoreHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BookStoreServer) error

RegisterBookStoreHandlerServer registers the http handlers for service BookStore to "mux". UnaryRPC :call BookStoreServer 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 RegisterBookStoreHandlerFromEndpoint instead.

func RegisterBookStoreServer

func RegisterBookStoreServer(s grpc.ServiceRegistrar, srv BookStoreServer)

Types

type Book

type Book struct {
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// contains filtered or unexported fields
}

func (*Book) Descriptor deprecated

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

Deprecated: Use Book.ProtoReflect.Descriptor instead.

func (*Book) GetPath

func (x *Book) GetPath() string

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 BookStoreClient

type BookStoreClient interface {
	CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error)
	ReadBook(ctx context.Context, in *ReadBookRequest, opts ...grpc.CallOption) (*Book, error)
}

BookStoreClient is the client API for BookStore 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 NewBookStoreClient

func NewBookStoreClient(cc grpc.ClientConnInterface) BookStoreClient

type BookStoreServer

type BookStoreServer interface {
	CreateBook(context.Context, *CreateBookRequest) (*Book, error)
	ReadBook(context.Context, *ReadBookRequest) (*Book, error)
	// contains filtered or unexported methods
}

BookStoreServer is the server API for BookStore service. All implementations must embed UnimplementedBookStoreServer for forward compatibility

type CreateBookRequest

type CreateBookRequest struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Resource *Book  `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateBookRequest) Descriptor deprecated

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

Deprecated: Use CreateBookRequest.ProtoReflect.Descriptor instead.

func (*CreateBookRequest) GetId

func (x *CreateBookRequest) GetId() string

func (*CreateBookRequest) GetResource

func (x *CreateBookRequest) GetResource() *Book

func (*CreateBookRequest) ProtoMessage

func (*CreateBookRequest) ProtoMessage()

func (*CreateBookRequest) ProtoReflect

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

func (*CreateBookRequest) Reset

func (x *CreateBookRequest) Reset()

func (*CreateBookRequest) String

func (x *CreateBookRequest) String() string

type ReadBookRequest

type ReadBookRequest struct {
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadBookRequest) Descriptor deprecated

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

Deprecated: Use ReadBookRequest.ProtoReflect.Descriptor instead.

func (*ReadBookRequest) GetPath

func (x *ReadBookRequest) GetPath() string

func (*ReadBookRequest) ProtoMessage

func (*ReadBookRequest) ProtoMessage()

func (*ReadBookRequest) ProtoReflect

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

func (*ReadBookRequest) Reset

func (x *ReadBookRequest) Reset()

func (*ReadBookRequest) String

func (x *ReadBookRequest) String() string

type UnimplementedBookStoreServer

type UnimplementedBookStoreServer struct {
}

UnimplementedBookStoreServer must be embedded to have forward compatible implementations.

func (UnimplementedBookStoreServer) CreateBook

func (UnimplementedBookStoreServer) ReadBook

type UnsafeBookStoreServer

type UnsafeBookStoreServer interface {
	// contains filtered or unexported methods
}

UnsafeBookStoreServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BookStoreServer will result in compilation errors.

Jump to

Keyboard shortcuts

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