helloworldv1

package
v0.0.0-...-a89d410 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package helloworldv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Error_name = map[int32]string{
		0:    "ERROR_UNSPECIFIED",
		1000: "ERROR_NAME_INVALID",
	}
	Error_value = map[string]int32{
		"ERROR_UNSPECIFIED":  0,
		"ERROR_NAME_INVALID": 1000,
	}
)

Enum value maps for Error.

View Source
var (
	Type_name = map[int32]string{
		0: "TYPE_UNSPECIFIED",
		1: "TYPE_FILTER",
		2: "TYPE_PRUNE",
	}
	Type_value = map[string]int32{
		"TYPE_UNSPECIFIED": 0,
		"TYPE_FILTER":      1,
		"TYPE_PRUNE":       2,
	}
)

Enum value maps for Type.

View Source
var (
	Sex_name = map[int32]string{
		0: "SEX_UNSPECIFIED",
		1: "SEX_MALE",
		2: "SEX_FEMALE",
	}
	Sex_value = map[string]int32{
		"SEX_UNSPECIFIED": 0,
		"SEX_MALE":        1,
		"SEX_FEMALE":      2,
	}
)

Enum value maps for Sex.

View Source
var ErrFoo = errors.New("error foo")

ErrFoo ...

View Source
var File_helloworld_v1_error_proto protoreflect.FileDescriptor
View Source
var File_helloworld_v1_helloworld_proto protoreflect.FileDescriptor
View Source
var GreeterService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "helloworld.v1.GreeterService",
	HandlerType: (*GreeterServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _GreeterService_SayHello_Handler,
		},
		{
			MethodName: "SayHi",
			Handler:    _GreeterService_SayHi_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "helloworld/v1/helloworld.proto",
}

GreeterService_ServiceDesc is the grpc.ServiceDesc for GreeterService 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 StatusFoo = status.Errorf(codes.DataLoss, ErrFoo.Error())

StatusFoo ...

View Source
var XERROR_ERROR_NAME_INVALID = xerror.New(1000, "name is invalid")

ERROR_NAME_INVALID is the error code for invalid name.

Functions

func RegisterGreeterServiceEchoServer

func RegisterGreeterServiceEchoServer(r *v4.Echo, srv GreeterServiceEchoServer)

func RegisterGreeterServiceGinServer

func RegisterGreeterServiceGinServer(r *gin.Engine, srv GreeterServiceGinServer)

func RegisterGreeterServiceHandler

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

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

func RegisterGreeterServiceHandlerClient

func RegisterGreeterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterServiceClient) error

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

func RegisterGreeterServiceHandlerFromEndpoint

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

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

func RegisterGreeterServiceHandlerServer

func RegisterGreeterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServiceServer) error

RegisterGreeterServiceHandlerServer registers the http handlers for service GreeterService to "mux". UnaryRPC :call GreeterServiceServer 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 RegisterGreeterServiceHandlerFromEndpoint instead.

func RegisterGreeterServiceServer

func RegisterGreeterServiceServer(s grpc.ServiceRegistrar, srv GreeterServiceServer)

Types

type Error

type Error int32

Error codes for the helloworld.v1 package.

const (
	// ERROR_UNSPECIFIED is the invalid code.
	Error_ERROR_UNSPECIFIED Error = 0
	// ERROR_NAME_INVALID is the error code for invalid name.
	Error_ERROR_NAME_INVALID Error = 1000
)

func (Error) Descriptor

func (Error) Descriptor() protoreflect.EnumDescriptor

func (Error) Enum

func (x Error) Enum() *Error

func (Error) EnumDescriptor deprecated

func (Error) EnumDescriptor() ([]byte, []int)

Deprecated: Use Error.Descriptor instead.

func (Error) Number

func (x Error) Number() protoreflect.EnumNumber

func (Error) String

func (x Error) String() string

func (Error) Type

func (Error) Type() protoreflect.EnumType

type FooServer

type FooServer struct {
	UnimplementedGreeterServiceServer
	// contains filtered or unexported fields
}

FooServer ...

func (*FooServer) SayHello

func (s *FooServer) SayHello(ctx context.Context, in *SayHelloRequest) (out *SayHelloResponse, err error)

SayHello ...

func (*FooServer) SetHook

func (s *FooServer) SetHook(f func(context.Context))

SetHook ...

type GreeterServiceClient

type GreeterServiceClient interface {
	// Sends a hello greeting
	SayHello(ctx context.Context, in *SayHelloRequest, opts ...grpc.CallOption) (*SayHelloResponse, error)
	// Sends a hi greeting
	SayHi(ctx context.Context, in *SayHiRequest, opts ...grpc.CallOption) (*SayHiResponse, error)
}

GreeterServiceClient is the client API for GreeterService 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 GreeterServiceEchoServer

type GreeterServiceEchoServer interface {

	// Sends a hello greeting
	SayHello(context.Context, *SayHelloRequest) (*SayHelloResponse, error)

	// Sends a hi greeting
	SayHi(context.Context, *SayHiRequest) (*SayHiResponse, error)
}

type GreeterServiceGinServer

type GreeterServiceGinServer interface {

	// Sends a hello greeting
	SayHello(context.Context, *SayHelloRequest) (*SayHelloResponse, error)

	// Sends a hi greeting
	SayHi(context.Context, *SayHiRequest) (*SayHiResponse, error)
}

type GreeterServiceServer

type GreeterServiceServer interface {
	// Sends a hello greeting
	SayHello(context.Context, *SayHelloRequest) (*SayHelloResponse, error)
	// Sends a hi greeting
	SayHi(context.Context, *SayHiRequest) (*SayHiResponse, error)
}

GreeterServiceServer is the server API for GreeterService service. All implementations should embed UnimplementedGreeterServiceServer for forward compatibility

type SayHelloRequest

type SayHelloRequest struct {

	// name ...
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" form:"name" param:"name" uri:"name"`
	// type filter mode
	Type Type `protobuf:"varint,2,opt,name=type,proto3,enum=helloworld.v1.Type" json:"type"`
	// update_mask FieldMask
	UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,json=updateMask,proto3" json:"updateMask"`
	// contains filtered or unexported fields
}

The request message containing the user's name.

func (*SayHelloRequest) Descriptor deprecated

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

Deprecated: Use SayHelloRequest.ProtoReflect.Descriptor instead.

func (*SayHelloRequest) FieldMaskFilter

func (x *SayHelloRequest) FieldMaskFilter() *SayHelloRequest_FieldMask

FieldMask_Filter generates *SayHelloRequest FieldMask with filter mode, so that only the fields in the SayHelloRequest.UpdateMask will be appended into the SayHelloRequest.

func (*SayHelloRequest) FieldMaskPrune

func (x *SayHelloRequest) FieldMaskPrune() *SayHelloRequest_FieldMask

FieldMask_Prune generates *SayHelloRequest FieldMask with prune mode, so that only the fields NOT in the SayHelloRequest.UpdateMask will be appended into the SayHelloRequest.

func (*SayHelloRequest) GetName

func (x *SayHelloRequest) GetName() string

func (*SayHelloRequest) GetType

func (x *SayHelloRequest) GetType() Type

func (*SayHelloRequest) GetUpdateMask

func (x *SayHelloRequest) GetUpdateMask() *fieldmaskpb.FieldMask

func (*SayHelloRequest) MaskInName

func (x *SayHelloRequest) MaskInName() *SayHelloRequest

MaskInName append Name into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskInType

func (x *SayHelloRequest) MaskInType() *SayHelloRequest

MaskInType append Type into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutData

func (x *SayHelloRequest) MaskOutData() *SayHelloRequest

MaskOutData append Data into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataAgeNumber

func (x *SayHelloRequest) MaskOutDataAgeNumber() *SayHelloRequest

MaskOutDataAgeNumber append DataAgeNumber into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataMetadata

func (x *SayHelloRequest) MaskOutDataMetadata() *SayHelloRequest

MaskOutDataMetadata append DataMetadata into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataMetadataKey

func (x *SayHelloRequest) MaskOutDataMetadataKey() *SayHelloRequest

MaskOutDataMetadataKey append DataMetadataKey into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataMetadataValue

func (x *SayHelloRequest) MaskOutDataMetadataValue() *SayHelloRequest

MaskOutDataMetadataValue append DataMetadataValue into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataName

func (x *SayHelloRequest) MaskOutDataName() *SayHelloRequest

MaskOutDataName append DataName into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutDataSex

func (x *SayHelloRequest) MaskOutDataSex() *SayHelloRequest

MaskOutDataSex append DataSex into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutError

func (x *SayHelloRequest) MaskOutError() *SayHelloRequest

MaskOutError append Error into SayHelloRequest.UpdateMask.

func (*SayHelloRequest) MaskOutMsg

func (x *SayHelloRequest) MaskOutMsg() *SayHelloRequest

MaskOutMsg append Msg into SayHelloRequest.UpdateMask.

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

type SayHelloRequest_FieldMask

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

SayHelloRequest_FieldMask provide helper functions to deal with FieldMask.

func (*SayHelloRequest_FieldMask) Mask

Mask only affects the fields in the SayHelloRequest.

func (*SayHelloRequest_FieldMask) MaskedInName

func (x *SayHelloRequest_FieldMask) MaskedInName() bool

MaskedInName indicates the field Name exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedInType

func (x *SayHelloRequest_FieldMask) MaskedInType() bool

MaskedInType indicates the field Type exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutData

func (x *SayHelloRequest_FieldMask) MaskedOutData() bool

MaskedOutData indicates the field Data exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataAgeNumber

func (x *SayHelloRequest_FieldMask) MaskedOutDataAgeNumber() bool

MaskedOutDataAgeNumber indicates the field DataAgeNumber exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataMetadata

func (x *SayHelloRequest_FieldMask) MaskedOutDataMetadata() bool

MaskedOutDataMetadata indicates the field DataMetadata exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataMetadataKey

func (x *SayHelloRequest_FieldMask) MaskedOutDataMetadataKey() bool

MaskedOutDataMetadataKey indicates the field DataMetadataKey exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataMetadataValue

func (x *SayHelloRequest_FieldMask) MaskedOutDataMetadataValue() bool

MaskedOutDataMetadataValue indicates the field DataMetadataValue exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataName

func (x *SayHelloRequest_FieldMask) MaskedOutDataName() bool

MaskedOutDataName indicates the field DataName exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutDataSex

func (x *SayHelloRequest_FieldMask) MaskedOutDataSex() bool

MaskedOutDataSex indicates the field DataSex exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutError

func (x *SayHelloRequest_FieldMask) MaskedOutError() bool

MaskedOutError indicates the field Error exists in the SayHelloRequest.UpdateMask or not.

func (*SayHelloRequest_FieldMask) MaskedOutMsg

func (x *SayHelloRequest_FieldMask) MaskedOutMsg() bool

MaskedOutMsg indicates the field Msg exists in the SayHelloRequest.UpdateMask or not.

type SayHelloResponse

type SayHelloResponse struct {

	// error
	Error uint32 `protobuf:"varint,1,opt,name=error,proto3" json:"error"`
	// msg
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
	// data ...
	Data *SayHelloResponse_Data `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
	// contains filtered or unexported fields
}

The response message containing the greetings

func (*SayHelloResponse) Descriptor deprecated

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

Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead.

func (*SayHelloResponse) GetData

func (*SayHelloResponse) GetError

func (x *SayHelloResponse) GetError() uint32

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

type SayHelloResponse_Data

type SayHelloResponse_Data struct {

	// name of the user
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"`
	// age_number is the age number.
	AgeNumber uint64 `protobuf:"varint,2,opt,name=age_number,json=ageNumber,proto3" json:"ageNumber"`
	// sex is the user's sex
	Sex Sex `protobuf:"varint,3,opt,name=sex,proto3,enum=helloworld.v1.Sex" json:"sex"`
	// metadata is the user's metadata
	Metadata map[string]string `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

Data is the data to be sent.

func (*SayHelloResponse_Data) Descriptor deprecated

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

Deprecated: Use SayHelloResponse_Data.ProtoReflect.Descriptor instead.

func (*SayHelloResponse_Data) GetAgeNumber

func (x *SayHelloResponse_Data) GetAgeNumber() uint64

func (*SayHelloResponse_Data) GetMetadata

func (x *SayHelloResponse_Data) GetMetadata() map[string]string

func (*SayHelloResponse_Data) GetName

func (x *SayHelloResponse_Data) GetName() string

func (*SayHelloResponse_Data) GetSex

func (x *SayHelloResponse_Data) GetSex() Sex

func (*SayHelloResponse_Data) ProtoMessage

func (*SayHelloResponse_Data) ProtoMessage()

func (*SayHelloResponse_Data) ProtoReflect

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

func (*SayHelloResponse_Data) Reset

func (x *SayHelloResponse_Data) Reset()

func (*SayHelloResponse_Data) String

func (x *SayHelloResponse_Data) String() string

type SayHiRequest

type SayHiRequest struct {

	// name ...
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" form:"name"`
	// contains filtered or unexported fields
}

The request message containing the user's name.

func (*SayHiRequest) Descriptor deprecated

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

Deprecated: Use SayHiRequest.ProtoReflect.Descriptor instead.

func (*SayHiRequest) GetName

func (x *SayHiRequest) GetName() string

func (*SayHiRequest) ProtoMessage

func (*SayHiRequest) ProtoMessage()

func (*SayHiRequest) ProtoReflect

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

func (*SayHiRequest) Reset

func (x *SayHiRequest) Reset()

func (*SayHiRequest) String

func (x *SayHiRequest) String() string

type SayHiResponse

type SayHiResponse struct {

	// error
	Error uint32 `protobuf:"varint,1,opt,name=error,proto3" json:"error"`
	// msg
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
	// data ...
	Data *SayHiResponse_Data `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
	// contains filtered or unexported fields
}

The response message containing the greetings

func (*SayHiResponse) Descriptor deprecated

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

Deprecated: Use SayHiResponse.ProtoReflect.Descriptor instead.

func (*SayHiResponse) GetData

func (x *SayHiResponse) GetData() *SayHiResponse_Data

func (*SayHiResponse) GetError

func (x *SayHiResponse) GetError() uint32

func (*SayHiResponse) GetMsg

func (x *SayHiResponse) GetMsg() string

func (*SayHiResponse) ProtoMessage

func (*SayHiResponse) ProtoMessage()

func (*SayHiResponse) ProtoReflect

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

func (*SayHiResponse) Reset

func (x *SayHiResponse) Reset()

func (*SayHiResponse) String

func (x *SayHiResponse) String() string

type SayHiResponse_Data

type SayHiResponse_Data struct {

	// name of the user
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"`
	// age_number is the age number.
	AgeNumber uint64 `protobuf:"varint,2,opt,name=age_number,json=ageNumber,proto3" json:"ageNumber"`
	// contains filtered or unexported fields
}

Data is the data to be sent.

func (*SayHiResponse_Data) Descriptor deprecated

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

Deprecated: Use SayHiResponse_Data.ProtoReflect.Descriptor instead.

func (*SayHiResponse_Data) GetAgeNumber

func (x *SayHiResponse_Data) GetAgeNumber() uint64

func (*SayHiResponse_Data) GetName

func (x *SayHiResponse_Data) GetName() string

func (*SayHiResponse_Data) ProtoMessage

func (*SayHiResponse_Data) ProtoMessage()

func (*SayHiResponse_Data) ProtoReflect

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

func (*SayHiResponse_Data) Reset

func (x *SayHiResponse_Data) Reset()

func (*SayHiResponse_Data) String

func (x *SayHiResponse_Data) String() string

type Sex

type Sex int32

Sex

const (
	// SEX_UNSPECIFIED ...
	Sex_SEX_UNSPECIFIED Sex = 0
	// SEX_MALE ...
	Sex_SEX_MALE Sex = 1
	// SEX_FEMALE ...
	Sex_SEX_FEMALE Sex = 2
)

func (Sex) Descriptor

func (Sex) Descriptor() protoreflect.EnumDescriptor

func (Sex) Enum

func (x Sex) Enum() *Sex

func (Sex) EnumDescriptor deprecated

func (Sex) EnumDescriptor() ([]byte, []int)

Deprecated: Use Sex.Descriptor instead.

func (Sex) Number

func (x Sex) Number() protoreflect.EnumNumber

func (Sex) String

func (x Sex) String() string

func (Sex) Type

func (Sex) Type() protoreflect.EnumType

type Type

type Type int32

Type

const (
	// TYPE_UNSPECIFIED ...
	Type_TYPE_UNSPECIFIED Type = 0
	// TYPE_FILTER ...
	Type_TYPE_FILTER Type = 1
	// TYPE_PRUNE ...
	Type_TYPE_PRUNE Type = 2
)

func (Type) Descriptor

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated

func (Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Type.Descriptor instead.

func (Type) Number

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

func (Type) Type

func (Type) Type() protoreflect.EnumType

type UnimplementedGreeterServiceServer

type UnimplementedGreeterServiceServer struct {
}

UnimplementedGreeterServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedGreeterServiceServer) SayHello

func (UnimplementedGreeterServiceServer) SayHi

type UnsafeGreeterServiceServer

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

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

Jump to

Keyboard shortcuts

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