v1

package
v0.0.0-...-da98b6b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 28 Imported by: 1

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 ExampleService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "example.v1.ExampleService",
	HandlerType: (*ExampleServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _ExampleService_SayHello_Handler,
		},
		{
			MethodName: "SayGoodbye",
			Handler:    _ExampleService_SayGoodbye_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "example/v1/service.proto",
}

ExampleService_ServiceDesc is the grpc.ServiceDesc for ExampleService 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_example_v1_service_proto protoreflect.FileDescriptor

Functions

func RegisterExampleServiceHandler

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

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

func RegisterExampleServiceHandlerClient

func RegisterExampleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleServiceClient) error

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

func RegisterExampleServiceHandlerFromEndpoint

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

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

func RegisterExampleServiceHandlerServer

func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error

RegisterExampleServiceHandlerServer registers the http handlers for service ExampleService to "mux". UnaryRPC :call ExampleServiceServer 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 RegisterExampleServiceHandlerFromEndpoint instead.

func RegisterExampleServiceServer

func RegisterExampleServiceServer(s grpc.ServiceRegistrar, srv ExampleServiceServer)

Types

type ExampleServiceClient

type ExampleServiceClient interface {
	// SayHello will send hello term to server.
	SayHello(ctx context.Context, in *SayHelloRequest, opts ...grpc.CallOption) (*SayHelloResponse, error)
	// SayGoodbye will send goodbye term to server.
	SayGoodbye(ctx context.Context, in *SayGoodbyeRequest, opts ...grpc.CallOption) (*SayGoodbyeResponse, error)
}

ExampleServiceClient is the client API for ExampleService 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 ExampleServiceServer

type ExampleServiceServer interface {
	// SayHello will send hello term to server.
	SayHello(context.Context, *SayHelloRequest) (*SayHelloResponse, error)
	// SayGoodbye will send goodbye term to server.
	SayGoodbye(context.Context, *SayGoodbyeRequest) (*SayGoodbyeResponse, error)
}

ExampleServiceServer is the server API for ExampleService service. All implementations should embed UnimplementedExampleServiceServer for forward compatibility

type SayGoodbyeRequest

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

SayGoodbyeRequest ...

func (*SayGoodbyeRequest) Descriptor deprecated

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

Deprecated: Use SayGoodbyeRequest.ProtoReflect.Descriptor instead.

func (*SayGoodbyeRequest) GetMsg

func (x *SayGoodbyeRequest) GetMsg() string

func (*SayGoodbyeRequest) ProtoMessage

func (*SayGoodbyeRequest) ProtoMessage()

func (*SayGoodbyeRequest) ProtoReflect

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

func (*SayGoodbyeRequest) Reset

func (x *SayGoodbyeRequest) Reset()

func (*SayGoodbyeRequest) String

func (x *SayGoodbyeRequest) String() string

func (*SayGoodbyeRequest) Validate

func (m *SayGoodbyeRequest) Validate() error

Validate checks the field values on SayGoodbyeRequest 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 (*SayGoodbyeRequest) ValidateAll

func (m *SayGoodbyeRequest) ValidateAll() error

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

type SayGoodbyeRequestMultiError

type SayGoodbyeRequestMultiError []error

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

func (SayGoodbyeRequestMultiError) AllErrors

func (m SayGoodbyeRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SayGoodbyeRequestMultiError) Error

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

type SayGoodbyeRequestValidationError

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

SayGoodbyeRequestValidationError is the validation error returned by SayGoodbyeRequest.Validate if the designated constraints aren't met.

func (SayGoodbyeRequestValidationError) Cause

Cause function returns cause value.

func (SayGoodbyeRequestValidationError) Error

Error satisfies the builtin error interface

func (SayGoodbyeRequestValidationError) ErrorName

ErrorName returns error name.

func (SayGoodbyeRequestValidationError) Field

Field function returns field value.

func (SayGoodbyeRequestValidationError) Key

Key function returns key value.

func (SayGoodbyeRequestValidationError) Reason

Reason function returns reason value.

type SayGoodbyeResponse

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

SayGoodbyeResponse ...

func (*SayGoodbyeResponse) Descriptor deprecated

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

Deprecated: Use SayGoodbyeResponse.ProtoReflect.Descriptor instead.

func (*SayGoodbyeResponse) GetMsg

func (x *SayGoodbyeResponse) GetMsg() string

func (*SayGoodbyeResponse) ProtoMessage

func (*SayGoodbyeResponse) ProtoMessage()

func (*SayGoodbyeResponse) ProtoReflect

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

func (*SayGoodbyeResponse) Reset

func (x *SayGoodbyeResponse) Reset()

func (*SayGoodbyeResponse) String

func (x *SayGoodbyeResponse) String() string

func (*SayGoodbyeResponse) Validate

func (m *SayGoodbyeResponse) Validate() error

Validate checks the field values on SayGoodbyeResponse 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 (*SayGoodbyeResponse) ValidateAll

func (m *SayGoodbyeResponse) ValidateAll() error

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

type SayGoodbyeResponseMultiError

type SayGoodbyeResponseMultiError []error

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

func (SayGoodbyeResponseMultiError) AllErrors

func (m SayGoodbyeResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SayGoodbyeResponseMultiError) Error

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

type SayGoodbyeResponseValidationError

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

SayGoodbyeResponseValidationError is the validation error returned by SayGoodbyeResponse.Validate if the designated constraints aren't met.

func (SayGoodbyeResponseValidationError) Cause

Cause function returns cause value.

func (SayGoodbyeResponseValidationError) Error

Error satisfies the builtin error interface

func (SayGoodbyeResponseValidationError) ErrorName

ErrorName returns error name.

func (SayGoodbyeResponseValidationError) Field

Field function returns field value.

func (SayGoodbyeResponseValidationError) Key

Key function returns key value.

func (SayGoodbyeResponseValidationError) Reason

Reason function returns reason value.

type SayHelloRequest

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

SayHelloRequest defines a hello request term.

func (*SayHelloRequest) Descriptor deprecated

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

Deprecated: Use SayHelloRequest.ProtoReflect.Descriptor instead.

func (*SayHelloRequest) GetMsg

func (x *SayHelloRequest) GetMsg() string

func (*SayHelloRequest) ProtoMessage

func (*SayHelloRequest) ProtoMessage()

func (*SayHelloRequest) ProtoReflect

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

func (*SayHelloRequest) Reset

func (x *SayHelloRequest) Reset()

func (*SayHelloRequest) String

func (x *SayHelloRequest) String() string

func (*SayHelloRequest) Validate

func (m *SayHelloRequest) Validate() error

Validate checks the field values on SayHelloRequest 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 (*SayHelloRequest) ValidateAll

func (m *SayHelloRequest) ValidateAll() error

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

type SayHelloRequestMultiError

type SayHelloRequestMultiError []error

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

func (SayHelloRequestMultiError) AllErrors

func (m SayHelloRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SayHelloRequestMultiError) Error

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

type SayHelloRequestValidationError

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

SayHelloRequestValidationError is the validation error returned by SayHelloRequest.Validate if the designated constraints aren't met.

func (SayHelloRequestValidationError) Cause

Cause function returns cause value.

func (SayHelloRequestValidationError) Error

Error satisfies the builtin error interface

func (SayHelloRequestValidationError) ErrorName

func (e SayHelloRequestValidationError) ErrorName() string

ErrorName returns error name.

func (SayHelloRequestValidationError) Field

Field function returns field value.

func (SayHelloRequestValidationError) Key

Key function returns key value.

func (SayHelloRequestValidationError) Reason

Reason function returns reason value.

type SayHelloResponse

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

SayHelloResponse ...

func (*SayHelloResponse) Descriptor deprecated

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

Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead.

func (*SayHelloResponse) GetMsg

func (x *SayHelloResponse) GetMsg() string

func (*SayHelloResponse) ProtoMessage

func (*SayHelloResponse) ProtoMessage()

func (*SayHelloResponse) ProtoReflect

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

func (*SayHelloResponse) Reset

func (x *SayHelloResponse) Reset()

func (*SayHelloResponse) String

func (x *SayHelloResponse) String() string

func (*SayHelloResponse) Validate

func (m *SayHelloResponse) Validate() error

Validate checks the field values on SayHelloResponse 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 (*SayHelloResponse) ValidateAll

func (m *SayHelloResponse) ValidateAll() error

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

type SayHelloResponseMultiError

type SayHelloResponseMultiError []error

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

func (SayHelloResponseMultiError) AllErrors

func (m SayHelloResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SayHelloResponseMultiError) Error

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

type SayHelloResponseValidationError

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

SayHelloResponseValidationError is the validation error returned by SayHelloResponse.Validate if the designated constraints aren't met.

func (SayHelloResponseValidationError) Cause

Cause function returns cause value.

func (SayHelloResponseValidationError) Error

Error satisfies the builtin error interface

func (SayHelloResponseValidationError) ErrorName

ErrorName returns error name.

func (SayHelloResponseValidationError) Field

Field function returns field value.

func (SayHelloResponseValidationError) Key

Key function returns key value.

func (SayHelloResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedExampleServiceServer

type UnimplementedExampleServiceServer struct {
}

UnimplementedExampleServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedExampleServiceServer) SayGoodbye

func (UnimplementedExampleServiceServer) SayHello

type UnsafeExampleServiceServer

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

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

Jump to

Keyboard shortcuts

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