gen

package
v0.0.0-...-b934907 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package gen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Default_Greeting_FullMethodName = "/com.github.veqryn.awesome.Default/Greeting"
	Default_Review_FullMethodName   = "/com.github.veqryn.awesome.Default/Review"
	Default_Error_FullMethodName    = "/com.github.veqryn.awesome.Default/Error"
)

Variables

View Source
var Default_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "com.github.veqryn.awesome.Default",
	HandlerType: (*DefaultServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Greeting",
			Handler:    _Default_Greeting_Handler,
		},
		{
			MethodName: "Review",
			Handler:    _Default_Review_Handler,
		},
		{
			MethodName: "Error",
			Handler:    _Default_Error_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "awesome.proto",
}

Default_ServiceDesc is the grpc.ServiceDesc for Default 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_awesome_proto protoreflect.FileDescriptor

Functions

func RegisterDefaultHandler

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

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

func RegisterDefaultHandlerClient

func RegisterDefaultHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DefaultClient) error

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

func RegisterDefaultHandlerFromEndpoint

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

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

func RegisterDefaultHandlerServer

func RegisterDefaultHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DefaultServer) error

RegisterDefaultHandlerServer registers the http handlers for service Default to "mux". UnaryRPC :call DefaultServer 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 RegisterDefaultHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterDefaultServer

func RegisterDefaultServer(s grpc.ServiceRegistrar, srv DefaultServer)

Types

type DefaultClient

type DefaultClient interface {
	Greeting(ctx context.Context, in *GreetingReq, opts ...grpc.CallOption) (*GreetingResp, error)
	Review(ctx context.Context, in *ReviewReq, opts ...grpc.CallOption) (*ReviewResp, error)
	Error(ctx context.Context, in *ErrorReq, opts ...grpc.CallOption) (*ErrorResp, error)
}

DefaultClient is the client API for Default 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.

The service definition.

func NewDefaultClient

func NewDefaultClient(cc grpc.ClientConnInterface) DefaultClient

type DefaultServer

type DefaultServer interface {
	Greeting(context.Context, *GreetingReq) (*GreetingResp, error)
	Review(context.Context, *ReviewReq) (*ReviewResp, error)
	Error(context.Context, *ErrorReq) (*ErrorResp, error)
}

DefaultServer is the server API for Default service. All implementations should embed UnimplementedDefaultServer for forward compatibility.

The service definition.

type ErrorReq

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

func (*ErrorReq) Descriptor deprecated

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

Deprecated: Use ErrorReq.ProtoReflect.Descriptor instead.

func (*ErrorReq) ProtoMessage

func (*ErrorReq) ProtoMessage()

func (*ErrorReq) ProtoReflect

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

func (*ErrorReq) Reset

func (x *ErrorReq) Reset()

func (*ErrorReq) String

func (x *ErrorReq) String() string

type ErrorResp

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

func (*ErrorResp) Descriptor deprecated

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

Deprecated: Use ErrorResp.ProtoReflect.Descriptor instead.

func (*ErrorResp) ProtoMessage

func (*ErrorResp) ProtoMessage()

func (*ErrorResp) ProtoReflect

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

func (*ErrorResp) Reset

func (x *ErrorResp) Reset()

func (*ErrorResp) String

func (x *ErrorResp) String() string

type GreetingReq

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

func (*GreetingReq) Descriptor deprecated

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

Deprecated: Use GreetingReq.ProtoReflect.Descriptor instead.

func (*GreetingReq) GetName

func (x *GreetingReq) GetName() string

func (*GreetingReq) ProtoMessage

func (*GreetingReq) ProtoMessage()

func (*GreetingReq) ProtoReflect

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

func (*GreetingReq) Reset

func (x *GreetingReq) Reset()

func (*GreetingReq) String

func (x *GreetingReq) String() string

type GreetingResp

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

func (*GreetingResp) Descriptor deprecated

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

Deprecated: Use GreetingResp.ProtoReflect.Descriptor instead.

func (*GreetingResp) GetMessage

func (x *GreetingResp) GetMessage() string

func (*GreetingResp) ProtoMessage

func (*GreetingResp) ProtoMessage()

func (*GreetingResp) ProtoReflect

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

func (*GreetingResp) Reset

func (x *GreetingResp) Reset()

func (*GreetingResp) String

func (x *GreetingResp) String() string

type ReviewReq

type ReviewReq struct {
	Author  string  `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"`
	Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"`
	Rating  int64   `protobuf:"varint,3,opt,name=rating,proto3" json:"rating,omitempty"`
	// contains filtered or unexported fields
}

func (*ReviewReq) Descriptor deprecated

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

Deprecated: Use ReviewReq.ProtoReflect.Descriptor instead.

func (*ReviewReq) GetAuthor

func (x *ReviewReq) GetAuthor() string

func (*ReviewReq) GetMessage

func (x *ReviewReq) GetMessage() string

func (*ReviewReq) GetRating

func (x *ReviewReq) GetRating() int64

func (*ReviewReq) ProtoMessage

func (*ReviewReq) ProtoMessage()

func (*ReviewReq) ProtoReflect

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

func (*ReviewReq) Reset

func (x *ReviewReq) Reset()

func (*ReviewReq) String

func (x *ReviewReq) String() string

type ReviewResp

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

func (*ReviewResp) Descriptor deprecated

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

Deprecated: Use ReviewResp.ProtoReflect.Descriptor instead.

func (*ReviewResp) ProtoMessage

func (*ReviewResp) ProtoMessage()

func (*ReviewResp) ProtoReflect

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

func (*ReviewResp) Reset

func (x *ReviewResp) Reset()

func (*ReviewResp) String

func (x *ReviewResp) String() string

type UnimplementedDefaultServer

type UnimplementedDefaultServer struct{}

UnimplementedDefaultServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedDefaultServer) Error

func (UnimplementedDefaultServer) Greeting

func (UnimplementedDefaultServer) Review

type UnsafeDefaultServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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