demo

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package demo is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_idl_demo_demo_proto protoreflect.FileDescriptor

Functions

func RegisterDemoServiceHandler

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

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

func RegisterDemoServiceHandlerClient

func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error

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

func RegisterDemoServiceHandlerFromEndpoint

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

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

func RegisterDemoServiceHandlerServer

func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error

RegisterDemoServiceHandlerServer registers the http handlers for service DemoService to "mux". UnaryRPC :call DemoServiceServer 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 RegisterDemoServiceHandlerFromEndpoint instead.

func RegisterDemoServiceServer

func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer)

Types

type DemoRequest

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

func (*DemoRequest) Descriptor deprecated

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

Deprecated: Use DemoRequest.ProtoReflect.Descriptor instead.

func (*DemoRequest) GetValue

func (x *DemoRequest) GetValue() string

func (*DemoRequest) ProtoMessage

func (*DemoRequest) ProtoMessage()

func (*DemoRequest) ProtoReflect

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

func (*DemoRequest) Reset

func (x *DemoRequest) Reset()

func (*DemoRequest) String

func (x *DemoRequest) String() string

func (*DemoRequest) Validate added in v0.7.2

func (m *DemoRequest) Validate() error

Validate checks the field values on DemoRequest 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 (*DemoRequest) ValidateAll added in v0.7.2

func (m *DemoRequest) ValidateAll() error

ValidateAll checks the field values on DemoRequest 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 DemoRequestMultiError, or nil if none found.

type DemoRequestMultiError added in v0.7.2

type DemoRequestMultiError []error

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

func (DemoRequestMultiError) AllErrors added in v0.7.2

func (m DemoRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (DemoRequestMultiError) Error added in v0.7.2

func (m DemoRequestMultiError) Error() string

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

type DemoRequestValidationError added in v0.7.2

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

DemoRequestValidationError is the validation error returned by DemoRequest.Validate if the designated constraints aren't met.

func (DemoRequestValidationError) Cause added in v0.7.2

Cause function returns cause value.

func (DemoRequestValidationError) Error added in v0.7.2

Error satisfies the builtin error interface

func (DemoRequestValidationError) ErrorName added in v0.7.2

func (e DemoRequestValidationError) ErrorName() string

ErrorName returns error name.

func (DemoRequestValidationError) Field added in v0.7.2

Field function returns field value.

func (DemoRequestValidationError) Key added in v0.7.2

Key function returns key value.

func (DemoRequestValidationError) Reason added in v0.7.2

Reason function returns reason value.

type DemoResponse

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

func (*DemoResponse) Descriptor deprecated

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

Deprecated: Use DemoResponse.ProtoReflect.Descriptor instead.

func (*DemoResponse) GetValue added in v0.7.2

func (x *DemoResponse) GetValue() string

func (*DemoResponse) ProtoMessage

func (*DemoResponse) ProtoMessage()

func (*DemoResponse) ProtoReflect

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

func (*DemoResponse) Reset

func (x *DemoResponse) Reset()

func (*DemoResponse) String

func (x *DemoResponse) String() string

func (*DemoResponse) Validate added in v0.7.2

func (m *DemoResponse) Validate() error

Validate checks the field values on DemoResponse 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 (*DemoResponse) ValidateAll added in v0.7.2

func (m *DemoResponse) ValidateAll() error

ValidateAll checks the field values on DemoResponse 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 DemoResponseMultiError, or nil if none found.

type DemoResponseMultiError added in v0.7.2

type DemoResponseMultiError []error

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

func (DemoResponseMultiError) AllErrors added in v0.7.2

func (m DemoResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (DemoResponseMultiError) Error added in v0.7.2

func (m DemoResponseMultiError) Error() string

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

type DemoResponseValidationError added in v0.7.2

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

DemoResponseValidationError is the validation error returned by DemoResponse.Validate if the designated constraints aren't met.

func (DemoResponseValidationError) Cause added in v0.7.2

Cause function returns cause value.

func (DemoResponseValidationError) Error added in v0.7.2

Error satisfies the builtin error interface

func (DemoResponseValidationError) ErrorName added in v0.7.2

func (e DemoResponseValidationError) ErrorName() string

ErrorName returns error name.

func (DemoResponseValidationError) Field added in v0.7.2

Field function returns field value.

func (DemoResponseValidationError) Key added in v0.7.2

Key function returns key value.

func (DemoResponseValidationError) Reason added in v0.7.2

Reason function returns reason value.

type DemoServiceClient

type DemoServiceClient interface {
	// Demo 样例接口
	Demo(ctx context.Context, in *DemoRequest, opts ...grpc.CallOption) (*DemoResponse, error)
	// Empty 空接口
	Empty(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*EmptyResponse, error)
}

DemoServiceClient is the client API for DemoService 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.

type DemoServiceServer

type DemoServiceServer interface {
	// Demo 样例接口
	Demo(context.Context, *DemoRequest) (*DemoResponse, error)
	// Empty 空接口
	Empty(context.Context, *EmptyRequest) (*EmptyResponse, error)
	// contains filtered or unexported methods
}

DemoServiceServer is the server API for DemoService service. All implementations must embed UnimplementedDemoServiceServer for forward compatibility

type EmptyRequest added in v0.7.2

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

func (*EmptyRequest) Descriptor deprecated added in v0.7.2

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

Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead.

func (*EmptyRequest) ProtoMessage added in v0.7.2

func (*EmptyRequest) ProtoMessage()

func (*EmptyRequest) ProtoReflect added in v0.7.2

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

func (*EmptyRequest) Reset added in v0.7.2

func (x *EmptyRequest) Reset()

func (*EmptyRequest) String added in v0.7.2

func (x *EmptyRequest) String() string

func (*EmptyRequest) Validate added in v0.7.2

func (m *EmptyRequest) Validate() error

Validate checks the field values on EmptyRequest 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 (*EmptyRequest) ValidateAll added in v0.7.2

func (m *EmptyRequest) ValidateAll() error

ValidateAll checks the field values on EmptyRequest 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 EmptyRequestMultiError, or nil if none found.

type EmptyRequestMultiError added in v0.7.2

type EmptyRequestMultiError []error

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

func (EmptyRequestMultiError) AllErrors added in v0.7.2

func (m EmptyRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EmptyRequestMultiError) Error added in v0.7.2

func (m EmptyRequestMultiError) Error() string

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

type EmptyRequestValidationError added in v0.7.2

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

EmptyRequestValidationError is the validation error returned by EmptyRequest.Validate if the designated constraints aren't met.

func (EmptyRequestValidationError) Cause added in v0.7.2

Cause function returns cause value.

func (EmptyRequestValidationError) Error added in v0.7.2

Error satisfies the builtin error interface

func (EmptyRequestValidationError) ErrorName added in v0.7.2

func (e EmptyRequestValidationError) ErrorName() string

ErrorName returns error name.

func (EmptyRequestValidationError) Field added in v0.7.2

Field function returns field value.

func (EmptyRequestValidationError) Key added in v0.7.2

Key function returns key value.

func (EmptyRequestValidationError) Reason added in v0.7.2

Reason function returns reason value.

type EmptyResponse added in v0.7.2

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

func (*EmptyResponse) Descriptor deprecated added in v0.7.2

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

Deprecated: Use EmptyResponse.ProtoReflect.Descriptor instead.

func (*EmptyResponse) ProtoMessage added in v0.7.2

func (*EmptyResponse) ProtoMessage()

func (*EmptyResponse) ProtoReflect added in v0.7.2

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

func (*EmptyResponse) Reset added in v0.7.2

func (x *EmptyResponse) Reset()

func (*EmptyResponse) String added in v0.7.2

func (x *EmptyResponse) String() string

func (*EmptyResponse) Validate added in v0.7.2

func (m *EmptyResponse) Validate() error

Validate checks the field values on EmptyResponse 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 (*EmptyResponse) ValidateAll added in v0.7.2

func (m *EmptyResponse) ValidateAll() error

ValidateAll checks the field values on EmptyResponse 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 EmptyResponseMultiError, or nil if none found.

type EmptyResponseMultiError added in v0.7.2

type EmptyResponseMultiError []error

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

func (EmptyResponseMultiError) AllErrors added in v0.7.2

func (m EmptyResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EmptyResponseMultiError) Error added in v0.7.2

func (m EmptyResponseMultiError) Error() string

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

type EmptyResponseValidationError added in v0.7.2

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

EmptyResponseValidationError is the validation error returned by EmptyResponse.Validate if the designated constraints aren't met.

func (EmptyResponseValidationError) Cause added in v0.7.2

Cause function returns cause value.

func (EmptyResponseValidationError) Error added in v0.7.2

Error satisfies the builtin error interface

func (EmptyResponseValidationError) ErrorName added in v0.7.2

func (e EmptyResponseValidationError) ErrorName() string

ErrorName returns error name.

func (EmptyResponseValidationError) Field added in v0.7.2

Field function returns field value.

func (EmptyResponseValidationError) Key added in v0.7.2

Key function returns key value.

func (EmptyResponseValidationError) Reason added in v0.7.2

Reason function returns reason value.

type UnimplementedDemoServiceServer

type UnimplementedDemoServiceServer struct {
}

UnimplementedDemoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedDemoServiceServer) Demo added in v0.7.2

func (UnimplementedDemoServiceServer) Empty added in v0.2.0

type UnsafeDemoServiceServer

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

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

Jump to

Keyboard shortcuts

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