proto

package
v0.0.0-...-4856d1d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Median_PushNumber_FullMethodName = "/median.median/PushNumber"
	Median_GetMedian_FullMethodName  = "/median.median/GetMedian"
)

Variables

View Source
var File_median_proto protoreflect.FileDescriptor
View Source
var Median_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "median.median",
	HandlerType: (*MedianServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PushNumber",
			Handler:    _Median_PushNumber_Handler,
		},
		{
			MethodName: "GetMedian",
			Handler:    _Median_GetMedian_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "median.proto",
}

Median_ServiceDesc is the grpc.ServiceDesc for Median service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterMedianHandler

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

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

func RegisterMedianHandlerClient

func RegisterMedianHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MedianClient) error

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

func RegisterMedianHandlerFromEndpoint

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

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

func RegisterMedianHandlerServer

func RegisterMedianHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MedianServer) error

RegisterMedianHandlerServer registers the http handlers for service Median to "mux". UnaryRPC :call MedianServer 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 RegisterMedianHandlerFromEndpoint instead.

func RegisterMedianServer

func RegisterMedianServer(s grpc.ServiceRegistrar, srv MedianServer)

Types

type GetMedianRequest

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

func (*GetMedianRequest) Descriptor deprecated

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

Deprecated: Use GetMedianRequest.ProtoReflect.Descriptor instead.

func (*GetMedianRequest) ProtoMessage

func (*GetMedianRequest) ProtoMessage()

func (*GetMedianRequest) ProtoReflect

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

func (*GetMedianRequest) Reset

func (x *GetMedianRequest) Reset()

func (*GetMedianRequest) String

func (x *GetMedianRequest) String() string

func (*GetMedianRequest) Validate

func (m *GetMedianRequest) Validate() error

Validate checks the field values on GetMedianRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetMedianRequest) ValidateAll

func (m *GetMedianRequest) ValidateAll() error

ValidateAll checks the field values on GetMedianRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetMedianRequestMultiError, or nil if none found.

type GetMedianRequestMultiError

type GetMedianRequestMultiError []error

GetMedianRequestMultiError is an error wrapping multiple validation errors returned by GetMedianRequest.ValidateAll() if the designated constraints aren't met.

func (GetMedianRequestMultiError) AllErrors

func (m GetMedianRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetMedianRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetMedianRequestValidationError

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

GetMedianRequestValidationError is the validation error returned by GetMedianRequest.Validate if the designated constraints aren't met.

func (GetMedianRequestValidationError) Cause

Cause function returns cause value.

func (GetMedianRequestValidationError) Error

Error satisfies the builtin error interface

func (GetMedianRequestValidationError) ErrorName

ErrorName returns error name.

func (GetMedianRequestValidationError) Field

Field function returns field value.

func (GetMedianRequestValidationError) Key

Key function returns key value.

func (GetMedianRequestValidationError) Reason

Reason function returns reason value.

type GetMedianResponse

type GetMedianResponse struct {
	Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*GetMedianResponse) Descriptor deprecated

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

Deprecated: Use GetMedianResponse.ProtoReflect.Descriptor instead.

func (*GetMedianResponse) GetStatus

func (x *GetMedianResponse) GetStatus() *Status

func (*GetMedianResponse) ProtoMessage

func (*GetMedianResponse) ProtoMessage()

func (*GetMedianResponse) ProtoReflect

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

func (*GetMedianResponse) Reset

func (x *GetMedianResponse) Reset()

func (*GetMedianResponse) String

func (x *GetMedianResponse) String() string

func (*GetMedianResponse) Validate

func (m *GetMedianResponse) Validate() error

Validate checks the field values on GetMedianResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetMedianResponse) ValidateAll

func (m *GetMedianResponse) ValidateAll() error

ValidateAll checks the field values on GetMedianResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetMedianResponseMultiError, or nil if none found.

type GetMedianResponseMultiError

type GetMedianResponseMultiError []error

GetMedianResponseMultiError is an error wrapping multiple validation errors returned by GetMedianResponse.ValidateAll() if the designated constraints aren't met.

func (GetMedianResponseMultiError) AllErrors

func (m GetMedianResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetMedianResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetMedianResponseValidationError

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

GetMedianResponseValidationError is the validation error returned by GetMedianResponse.Validate if the designated constraints aren't met.

func (GetMedianResponseValidationError) Cause

Cause function returns cause value.

func (GetMedianResponseValidationError) Error

Error satisfies the builtin error interface

func (GetMedianResponseValidationError) ErrorName

ErrorName returns error name.

func (GetMedianResponseValidationError) Field

Field function returns field value.

func (GetMedianResponseValidationError) Key

Key function returns key value.

func (GetMedianResponseValidationError) Reason

Reason function returns reason value.

type MedianClient

type MedianClient interface {
	PushNumber(ctx context.Context, in *PushNumberRequest, opts ...grpc.CallOption) (*PushNumberResponse, error)
	GetMedian(ctx context.Context, in *GetMedianRequest, opts ...grpc.CallOption) (*GetMedianResponse, error)
}

MedianClient is the client API for Median 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 NewMedianClient

func NewMedianClient(cc grpc.ClientConnInterface) MedianClient

type MedianServer

type MedianServer interface {
	PushNumber(context.Context, *PushNumberRequest) (*PushNumberResponse, error)
	GetMedian(context.Context, *GetMedianRequest) (*GetMedianResponse, error)
	// contains filtered or unexported methods
}

MedianServer is the server API for Median service. All implementations must embed UnimplementedMedianServer for forward compatibility

type PushNumberRequest

type PushNumberRequest struct {
	Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	// contains filtered or unexported fields
}

func (*PushNumberRequest) Descriptor deprecated

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

Deprecated: Use PushNumberRequest.ProtoReflect.Descriptor instead.

func (*PushNumberRequest) GetNumber

func (x *PushNumberRequest) GetNumber() int32

func (*PushNumberRequest) ProtoMessage

func (*PushNumberRequest) ProtoMessage()

func (*PushNumberRequest) ProtoReflect

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

func (*PushNumberRequest) Reset

func (x *PushNumberRequest) Reset()

func (*PushNumberRequest) String

func (x *PushNumberRequest) String() string

func (*PushNumberRequest) Validate

func (m *PushNumberRequest) Validate() error

Validate checks the field values on PushNumberRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PushNumberRequest) ValidateAll

func (m *PushNumberRequest) ValidateAll() error

ValidateAll checks the field values on PushNumberRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PushNumberRequestMultiError, or nil if none found.

type PushNumberRequestMultiError

type PushNumberRequestMultiError []error

PushNumberRequestMultiError is an error wrapping multiple validation errors returned by PushNumberRequest.ValidateAll() if the designated constraints aren't met.

func (PushNumberRequestMultiError) AllErrors

func (m PushNumberRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PushNumberRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type PushNumberRequestValidationError

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

PushNumberRequestValidationError is the validation error returned by PushNumberRequest.Validate if the designated constraints aren't met.

func (PushNumberRequestValidationError) Cause

Cause function returns cause value.

func (PushNumberRequestValidationError) Error

Error satisfies the builtin error interface

func (PushNumberRequestValidationError) ErrorName

ErrorName returns error name.

func (PushNumberRequestValidationError) Field

Field function returns field value.

func (PushNumberRequestValidationError) Key

Key function returns key value.

func (PushNumberRequestValidationError) Reason

Reason function returns reason value.

type PushNumberResponse

type PushNumberResponse struct {
	Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*PushNumberResponse) Descriptor deprecated

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

Deprecated: Use PushNumberResponse.ProtoReflect.Descriptor instead.

func (*PushNumberResponse) GetStatus

func (x *PushNumberResponse) GetStatus() *Status

func (*PushNumberResponse) ProtoMessage

func (*PushNumberResponse) ProtoMessage()

func (*PushNumberResponse) ProtoReflect

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

func (*PushNumberResponse) Reset

func (x *PushNumberResponse) Reset()

func (*PushNumberResponse) String

func (x *PushNumberResponse) String() string

func (*PushNumberResponse) Validate

func (m *PushNumberResponse) Validate() error

Validate checks the field values on PushNumberResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PushNumberResponse) ValidateAll

func (m *PushNumberResponse) ValidateAll() error

ValidateAll checks the field values on PushNumberResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PushNumberResponseMultiError, or nil if none found.

type PushNumberResponseMultiError

type PushNumberResponseMultiError []error

PushNumberResponseMultiError is an error wrapping multiple validation errors returned by PushNumberResponse.ValidateAll() if the designated constraints aren't met.

func (PushNumberResponseMultiError) AllErrors

func (m PushNumberResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PushNumberResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type PushNumberResponseValidationError

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

PushNumberResponseValidationError is the validation error returned by PushNumberResponse.Validate if the designated constraints aren't met.

func (PushNumberResponseValidationError) Cause

Cause function returns cause value.

func (PushNumberResponseValidationError) Error

Error satisfies the builtin error interface

func (PushNumberResponseValidationError) ErrorName

ErrorName returns error name.

func (PushNumberResponseValidationError) Field

Field function returns field value.

func (PushNumberResponseValidationError) Key

Key function returns key value.

func (PushNumberResponseValidationError) Reason

Reason function returns reason value.

type Status

type Status struct {
	Median      float64                `protobuf:"fixed64,1,opt,name=median,proto3" json:"median,omitempty"`
	Size        int32                  `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	LastUpdated *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
	// contains filtered or unexported fields
}

func (*Status) Descriptor deprecated

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetLastUpdated

func (x *Status) GetLastUpdated() *timestamppb.Timestamp

func (*Status) GetMedian

func (x *Status) GetMedian() float64

func (*Status) GetSize

func (x *Status) GetSize() int32

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

func (*Status) Validate

func (m *Status) Validate() error

Validate checks the field values on Status with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Status) ValidateAll

func (m *Status) ValidateAll() error

ValidateAll checks the field values on Status with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StatusMultiError, or nil if none found.

type StatusMultiError

type StatusMultiError []error

StatusMultiError is an error wrapping multiple validation errors returned by Status.ValidateAll() if the designated constraints aren't met.

func (StatusMultiError) AllErrors

func (m StatusMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (StatusMultiError) Error

func (m StatusMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type StatusValidationError

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

StatusValidationError is the validation error returned by Status.Validate if the designated constraints aren't met.

func (StatusValidationError) Cause

func (e StatusValidationError) Cause() error

Cause function returns cause value.

func (StatusValidationError) Error

func (e StatusValidationError) Error() string

Error satisfies the builtin error interface

func (StatusValidationError) ErrorName

func (e StatusValidationError) ErrorName() string

ErrorName returns error name.

func (StatusValidationError) Field

func (e StatusValidationError) Field() string

Field function returns field value.

func (StatusValidationError) Key

func (e StatusValidationError) Key() bool

Key function returns key value.

func (StatusValidationError) Reason

func (e StatusValidationError) Reason() string

Reason function returns reason value.

type UnimplementedMedianServer

type UnimplementedMedianServer struct {
}

UnimplementedMedianServer must be embedded to have forward compatible implementations.

func (UnimplementedMedianServer) GetMedian

func (UnimplementedMedianServer) PushNumber

type UnsafeMedianServer

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

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

Jump to

Keyboard shortcuts

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