service

package
v0.0.0-...-c329c71 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package service is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Service_GetTags_FullMethodName    = "/service.Service/GetTags"
	Service_GetTagById_FullMethodName = "/service.Service/GetTagById"
	Service_SaveTag_FullMethodName    = "/service.Service/SaveTag"
	Service_UpdateTag_FullMethodName  = "/service.Service/UpdateTag"
	Service_DeleteTag_FullMethodName  = "/service.Service/DeleteTag"
)

Variables

View Source
var File_service_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetTags",
			Handler:    _Service_GetTags_Handler,
		},
		{
			MethodName: "GetTagById",
			Handler:    _Service_GetTagById_Handler,
		},
		{
			MethodName: "SaveTag",
			Handler:    _Service_SaveTag_Handler,
		},
		{
			MethodName: "UpdateTag",
			Handler:    _Service_UpdateTag_Handler,
		},
		{
			MethodName: "DeleteTag",
			Handler:    _Service_DeleteTag_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service/service.proto",
}

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

Functions

func RegisterServiceHandler

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

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

func RegisterServiceHandlerClient

func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error

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

func RegisterServiceHandlerFromEndpoint

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

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

func RegisterServiceHandlerServer

func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error

RegisterServiceHandlerServer registers the http handlers for service Service to "mux". UnaryRPC :call ServiceServer 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 RegisterServiceHandlerFromEndpoint instead.

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type ServiceClient

type ServiceClient interface {
	// obtains tags by name
	GetTags(ctx context.Context, in *tag.GetTagsQuery, opts ...grpc.CallOption) (*tag.GetTagsResponse, error)
	// obtains tag by id
	GetTagById(ctx context.Context, in *tag.TagId, opts ...grpc.CallOption) (*tag.Tag, error)
	// save tag
	SaveTag(ctx context.Context, in *tag.SaveTagRequest, opts ...grpc.CallOption) (*tag.Tag, error)
	// update tag
	UpdateTag(ctx context.Context, in *tag.UpdateTagRequest, opts ...grpc.CallOption) (*tag.Tag, error)
	// deletes a tag
	DeleteTag(ctx context.Context, in *tag.TagId, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

ServiceClient is the client API for Service 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.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// obtains tags by name
	GetTags(context.Context, *tag.GetTagsQuery) (*tag.GetTagsResponse, error)
	// obtains tag by id
	GetTagById(context.Context, *tag.TagId) (*tag.Tag, error)
	// save tag
	SaveTag(context.Context, *tag.SaveTagRequest) (*tag.Tag, error)
	// update tag
	UpdateTag(context.Context, *tag.UpdateTagRequest) (*tag.Tag, error)
	// deletes a tag
	DeleteTag(context.Context, *tag.TagId) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DeleteTag

func (UnimplementedServiceServer) GetTagById

func (UnimplementedServiceServer) GetTags

func (UnimplementedServiceServer) SaveTag

func (UnimplementedServiceServer) UpdateTag

type UnsafeServiceServer

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

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

Jump to

Keyboard shortcuts

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