arithmetic

package
Version: v0.0.0-...-01bf1f1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package arithmetic is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_arithmetic_arithmetic_proto protoreflect.FileDescriptor

Functions

func RegisterArithmeticHandler

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

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

func RegisterArithmeticHandlerClient

func RegisterArithmeticHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ArithmeticClient) error

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

func RegisterArithmeticHandlerFromEndpoint

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

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

func RegisterArithmeticHandlerServer

func RegisterArithmeticHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ArithmeticServer) error

RegisterArithmeticHandlerServer registers the http handlers for service Arithmetic to "mux". UnaryRPC :call ArithmeticServer 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 RegisterArithmeticHandlerFromEndpoint instead.

func RegisterArithmeticServer

func RegisterArithmeticServer(s grpc.ServiceRegistrar, srv ArithmeticServer)

Types

type ArithmeticClient

type ArithmeticClient interface {
	Add(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Divide(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Multiply(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Subtract(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

ArithmeticClient is the client API for Arithmetic 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 NewArithmeticClient

func NewArithmeticClient(cc grpc.ClientConnInterface) ArithmeticClient

type ArithmeticServer

type ArithmeticServer interface {
	Add(context.Context, *Request) (*Response, error)
	Divide(context.Context, *Request) (*Response, error)
	Multiply(context.Context, *Request) (*Response, error)
	Subtract(context.Context, *Request) (*Response, error)
}

ArithmeticServer is the server API for Arithmetic service. All implementations should embed UnimplementedArithmeticServer for forward compatibility

type Request

type Request struct {
	A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"`
	B int64 `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"`
	// contains filtered or unexported fields
}

The request message containing the two integers

func (*Request) Descriptor deprecated

This method has been deprecated.
func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetA

func (x *Request) GetA() int64

func (*Request) GetB

func (x *Request) GetB() int64

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Result int64 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

The response message containing the result

func (*Response) Descriptor deprecated

This method has been deprecated.
func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetResult

func (x *Response) GetResult() int64

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedArithmeticServer

type UnimplementedArithmeticServer struct {
}

UnimplementedArithmeticServer should be embedded to have forward compatible implementations.

func (UnimplementedArithmeticServer) Add

func (UnimplementedArithmeticServer) Divide

func (UnimplementedArithmeticServer) Multiply

func (UnimplementedArithmeticServer) Subtract

type UnsafeArithmeticServer

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL