simpleservice

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SimpleService_Health_FullMethodName = "/prefab.SimpleService/Health"
	SimpleService_Echo_FullMethodName   = "/prefab.SimpleService/Echo"
)

Variables

View Source
var File_examples_simpleserver_simpleservice_simpleservice_proto protoreflect.FileDescriptor
View Source
var SimpleService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "prefab.SimpleService",
	HandlerType: (*SimpleServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Health",
			Handler:    _SimpleService_Health_Handler,
		},
		{
			MethodName: "Echo",
			Handler:    _SimpleService_Echo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "examples/simpleserver/simpleservice/simpleservice.proto",
}

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

Functions

func RegisterSimpleServiceHandler

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

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

func RegisterSimpleServiceHandlerClient

func RegisterSimpleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SimpleServiceClient) error

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

func RegisterSimpleServiceHandlerFromEndpoint

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

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

func RegisterSimpleServiceHandlerServer

func RegisterSimpleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SimpleServiceServer) error

RegisterSimpleServiceHandlerServer registers the http handlers for service SimpleService to "mux". UnaryRPC :call SimpleServiceServer 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 RegisterSimpleServiceHandlerFromEndpoint 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 RegisterSimpleServiceServer

func RegisterSimpleServiceServer(s grpc.ServiceRegistrar, srv SimpleServiceServer)

Types

type EchoRequest

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

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetPing

func (x *EchoRequest) GetPing() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

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

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoResponse

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

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetPong

func (x *EchoResponse) GetPong() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

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

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

type HealthRequest

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

An empty request with no parameters for now.

func (*HealthRequest) Descriptor deprecated

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

Deprecated: Use HealthRequest.ProtoReflect.Descriptor instead.

func (*HealthRequest) ProtoMessage

func (*HealthRequest) ProtoMessage()

func (*HealthRequest) ProtoReflect

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

func (*HealthRequest) Reset

func (x *HealthRequest) Reset()

func (*HealthRequest) String

func (x *HealthRequest) String() string

type HealthResponse

type HealthResponse struct {

	// How the server is feeling.
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

The response message containing the current health status.

func (*HealthResponse) Descriptor deprecated

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

Deprecated: Use HealthResponse.ProtoReflect.Descriptor instead.

func (*HealthResponse) GetStatus

func (x *HealthResponse) GetStatus() string

func (*HealthResponse) ProtoMessage

func (*HealthResponse) ProtoMessage()

func (*HealthResponse) ProtoReflect

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

func (*HealthResponse) Reset

func (x *HealthResponse) Reset()

func (*HealthResponse) String

func (x *HealthResponse) String() string

type SimpleServiceClient

type SimpleServiceClient interface {
	// Health returns information about the current server's health status.
	Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
	// Echo responds with the same value as was in the request.
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
}

SimpleServiceClient is the client API for SimpleService 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 SimpleServiceServer

type SimpleServiceServer interface {
	// Health returns information about the current server's health status.
	Health(context.Context, *HealthRequest) (*HealthResponse, error)
	// Echo responds with the same value as was in the request.
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	// contains filtered or unexported methods
}

SimpleServiceServer is the server API for SimpleService service. All implementations must embed UnimplementedSimpleServiceServer for forward compatibility.

func New

func New() SimpleServiceServer

type UnimplementedSimpleServiceServer

type UnimplementedSimpleServiceServer struct{}

UnimplementedSimpleServiceServer must 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 (UnimplementedSimpleServiceServer) Echo

func (UnimplementedSimpleServiceServer) Health

type UnsafeSimpleServiceServer

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

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

Jump to

Keyboard shortcuts

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