service

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package service is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_service_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service.collector.service.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _Service_Create_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _Service_Get_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Service_Delete_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _Service_Update_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 CreateReply

type CreateReply struct {
	Code    int32        `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string       `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Service *ServiceMeta `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateReply) Descriptor deprecated

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

Deprecated: Use CreateReply.ProtoReflect.Descriptor instead.

func (*CreateReply) GetCode

func (x *CreateReply) GetCode() int32

func (*CreateReply) GetMessage

func (x *CreateReply) GetMessage() string

func (*CreateReply) GetService

func (x *CreateReply) GetService() *ServiceMeta

func (*CreateReply) ProtoMessage

func (*CreateReply) ProtoMessage()

func (*CreateReply) ProtoReflect

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

func (*CreateReply) Reset

func (x *CreateReply) Reset()

func (*CreateReply) String

func (x *CreateReply) String() string

type CreateRequest

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

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetDescribe

func (x *CreateRequest) GetDescribe() string

func (*CreateRequest) GetName

func (x *CreateRequest) GetName() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type DeleteReply

type DeleteReply struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteReply) Descriptor deprecated

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

Deprecated: Use DeleteReply.ProtoReflect.Descriptor instead.

func (*DeleteReply) GetCode

func (x *DeleteReply) GetCode() int32

func (*DeleteReply) GetMessage

func (x *DeleteReply) GetMessage() string

func (*DeleteReply) ProtoMessage

func (*DeleteReply) ProtoMessage()

func (*DeleteReply) ProtoReflect

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

func (*DeleteReply) Reset

func (x *DeleteReply) Reset()

func (*DeleteReply) String

func (x *DeleteReply) String() string

type DeleteRequest

type DeleteRequest struct {
	Uuid int32 `protobuf:"varint,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetUuid

func (x *DeleteRequest) GetUuid() int32

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type GetReply

type GetReply struct {
	Code     int32          `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message  string         `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Services []*ServiceMeta `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"`
	Count    int32          `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	Total    int32          `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"`
	Page     int32          `protobuf:"varint,6,opt,name=page,proto3" json:"page,omitempty"`
	Limit    int32          `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

func (*GetReply) Descriptor deprecated

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

Deprecated: Use GetReply.ProtoReflect.Descriptor instead.

func (*GetReply) GetCode

func (x *GetReply) GetCode() int32

func (*GetReply) GetCount

func (x *GetReply) GetCount() int32

func (*GetReply) GetLimit

func (x *GetReply) GetLimit() int32

func (*GetReply) GetMessage

func (x *GetReply) GetMessage() string

func (*GetReply) GetPage

func (x *GetReply) GetPage() int32

func (*GetReply) GetServices

func (x *GetReply) GetServices() []*ServiceMeta

func (*GetReply) GetTotal

func (x *GetReply) GetTotal() int32

func (*GetReply) ProtoMessage

func (*GetReply) ProtoMessage()

func (*GetReply) ProtoReflect

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

func (*GetReply) Reset

func (x *GetReply) Reset()

func (*GetReply) String

func (x *GetReply) String() string

type GetRequest

type GetRequest struct {
	Page  int32  `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	Limit int32  `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	Uuid  int32  `protobuf:"varint,3,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Name  string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetLimit

func (x *GetRequest) GetLimit() int32

func (*GetRequest) GetName

func (x *GetRequest) GetName() string

func (*GetRequest) GetPage

func (x *GetRequest) GetPage() int32

func (*GetRequest) GetUuid

func (x *GetRequest) GetUuid() int32

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type ServiceClient

type ServiceClient interface {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateReply, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteReply, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateReply, 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 ServiceMeta

type ServiceMeta struct {
	Uuid       int32                  `protobuf:"varint,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Name       string                 `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Describe   string                 `protobuf:"bytes,3,opt,name=describe,proto3" json:"describe,omitempty"`
	CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	UpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
	TenantId   int32                  `protobuf:"varint,6,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceMeta) Descriptor deprecated

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

Deprecated: Use ServiceMeta.ProtoReflect.Descriptor instead.

func (*ServiceMeta) GetCreateTime

func (x *ServiceMeta) GetCreateTime() *timestamppb.Timestamp

func (*ServiceMeta) GetDescribe

func (x *ServiceMeta) GetDescribe() string

func (*ServiceMeta) GetName

func (x *ServiceMeta) GetName() string

func (*ServiceMeta) GetTenantId

func (x *ServiceMeta) GetTenantId() int32

func (*ServiceMeta) GetUpdateTime

func (x *ServiceMeta) GetUpdateTime() *timestamppb.Timestamp

func (*ServiceMeta) GetUuid

func (x *ServiceMeta) GetUuid() int32

func (*ServiceMeta) ProtoMessage

func (*ServiceMeta) ProtoMessage()

func (*ServiceMeta) ProtoReflect

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

func (*ServiceMeta) Reset

func (x *ServiceMeta) Reset()

func (*ServiceMeta) String

func (x *ServiceMeta) String() string

type ServiceServer

type ServiceServer interface {
	Create(context.Context, *CreateRequest) (*CreateReply, error)
	Get(context.Context, *GetRequest) (*GetReply, error)
	Delete(context.Context, *DeleteRequest) (*DeleteReply, error)
	Update(context.Context, *UpdateRequest) (*UpdateReply, error)
	// contains filtered or unexported methods
}

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

type Timestamp

type Timestamp = timestamppb.Timestamp

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) Create

func (UnimplementedServiceServer) Delete

func (UnimplementedServiceServer) Get

func (UnimplementedServiceServer) Update

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.

type UpdateReply

type UpdateReply struct {
	Code    int32        `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string       `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Service *ServiceMeta `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateReply) Descriptor deprecated

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

Deprecated: Use UpdateReply.ProtoReflect.Descriptor instead.

func (*UpdateReply) GetCode

func (x *UpdateReply) GetCode() int32

func (*UpdateReply) GetMessage

func (x *UpdateReply) GetMessage() string

func (*UpdateReply) GetService

func (x *UpdateReply) GetService() *ServiceMeta

func (*UpdateReply) ProtoMessage

func (*UpdateReply) ProtoMessage()

func (*UpdateReply) ProtoReflect

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

func (*UpdateReply) Reset

func (x *UpdateReply) Reset()

func (*UpdateReply) String

func (x *UpdateReply) String() string

type UpdateRequest

type UpdateRequest struct {
	Uuid     int32  `protobuf:"varint,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Name     string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Describe string `protobuf:"bytes,3,opt,name=describe,proto3" json:"describe,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetDescribe

func (x *UpdateRequest) GetDescribe() string

func (*UpdateRequest) GetName

func (x *UpdateRequest) GetName() string

func (*UpdateRequest) GetUuid

func (x *UpdateRequest) GetUuid() int32

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

Jump to

Keyboard shortcuts

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