proto

package
v0.0.0-...-e192e2f 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: 17 Imported by: 0

Documentation

Overview

Package proto contains the GRPC client and server definitions for our sample

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_sample_proto protoreflect.FileDescriptor
View Source
var SampleService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.SampleService",
	HandlerType: (*SampleServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _SampleService_Create_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _SampleService_Update_Handler,
		},
		{
			MethodName: "List",
			Handler:    _SampleService_List_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _SampleService_Delete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "sample.proto",
}

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

Functions

func RegisterSampleServiceHandler

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

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

func RegisterSampleServiceHandlerClient

func RegisterSampleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SampleServiceClient) error

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

func RegisterSampleServiceHandlerFromEndpoint

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

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

func RegisterSampleServiceHandlerServer

func RegisterSampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SampleServiceServer) error

RegisterSampleServiceHandlerServer registers the http handlers for service SampleService to "mux". UnaryRPC :call SampleServiceServer 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 RegisterSampleServiceHandlerFromEndpoint instead.

func RegisterSampleServiceServer

func RegisterSampleServiceServer(s grpc.ServiceRegistrar, srv SampleServiceServer)

Types

type DeleteThingRequest

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

func (*DeleteThingRequest) Descriptor deprecated

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

Deprecated: Use DeleteThingRequest.ProtoReflect.Descriptor instead.

func (*DeleteThingRequest) GetId

func (x *DeleteThingRequest) GetId() string

func (*DeleteThingRequest) ProtoMessage

func (*DeleteThingRequest) ProtoMessage()

func (*DeleteThingRequest) ProtoReflect

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

func (*DeleteThingRequest) Reset

func (x *DeleteThingRequest) Reset()

func (*DeleteThingRequest) String

func (x *DeleteThingRequest) String() string

type SampleServiceClient

type SampleServiceClient interface {
	Create(ctx context.Context, in *Thing, opts ...grpc.CallOption) (*Thing, error)
	Update(ctx context.Context, in *Thing, opts ...grpc.CallOption) (*Thing, error)
	List(ctx context.Context, in *ThingFilter, opts ...grpc.CallOption) (*ThingList, error)
	Delete(ctx context.Context, in *DeleteThingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

SampleServiceClient is the client API for SampleService 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 SampleServiceServer

type SampleServiceServer interface {
	Create(context.Context, *Thing) (*Thing, error)
	Update(context.Context, *Thing) (*Thing, error)
	List(context.Context, *ThingFilter) (*ThingList, error)
	Delete(context.Context, *DeleteThingRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

SampleServiceServer is the server API for SampleService service. All implementations must embed UnimplementedSampleServiceServer for forward compatibility

type Thing

type Thing struct {
	Id     string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Field1 string `protobuf:"bytes,2,opt,name=field1,proto3" json:"field1,omitempty"`
	Field2 string `protobuf:"bytes,3,opt,name=field2,proto3" json:"field2,omitempty"`
	// contains filtered or unexported fields
}

func (*Thing) Descriptor deprecated

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

Deprecated: Use Thing.ProtoReflect.Descriptor instead.

func (*Thing) GetField1

func (x *Thing) GetField1() string

func (*Thing) GetField2

func (x *Thing) GetField2() string

func (*Thing) GetId

func (x *Thing) GetId() string

func (*Thing) ProtoMessage

func (*Thing) ProtoMessage()

func (*Thing) ProtoReflect

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

func (*Thing) Reset

func (x *Thing) Reset()

func (*Thing) String

func (x *Thing) String() string

type ThingFilter

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

func (*ThingFilter) Descriptor deprecated

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

Deprecated: Use ThingFilter.ProtoReflect.Descriptor instead.

func (*ThingFilter) GetId

func (x *ThingFilter) GetId() string

func (*ThingFilter) ProtoMessage

func (*ThingFilter) ProtoMessage()

func (*ThingFilter) ProtoReflect

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

func (*ThingFilter) Reset

func (x *ThingFilter) Reset()

func (*ThingFilter) String

func (x *ThingFilter) String() string

type ThingList

type ThingList struct {
	Items []*Thing `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*ThingList) Descriptor deprecated

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

Deprecated: Use ThingList.ProtoReflect.Descriptor instead.

func (*ThingList) GetItems

func (x *ThingList) GetItems() []*Thing

func (*ThingList) ProtoMessage

func (*ThingList) ProtoMessage()

func (*ThingList) ProtoReflect

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

func (*ThingList) Reset

func (x *ThingList) Reset()

func (*ThingList) String

func (x *ThingList) String() string

type UnimplementedSampleServiceServer

type UnimplementedSampleServiceServer struct {
}

UnimplementedSampleServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedSampleServiceServer) Create

func (UnimplementedSampleServiceServer) Delete

func (UnimplementedSampleServiceServer) List

func (UnimplementedSampleServiceServer) Update

type UnsafeSampleServiceServer

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

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

Jump to

Keyboard shortcuts

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