Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type CreateServiceRequest
- func (*CreateServiceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateServiceRequest) GetDomain() string
- func (x *CreateServiceRequest) GetName() string
- func (x *CreateServiceRequest) GetNamespace() string
- func (*CreateServiceRequest) ProtoMessage()
- func (x *CreateServiceRequest) ProtoReflect() protoreflect.Message
- func (x *CreateServiceRequest) Reset()
- func (x *CreateServiceRequest) String() string
- type Credential
- func (*Credential) Descriptor() ([]byte, []int)deprecated
- func (x *Credential) GetClientId() string
- func (x *Credential) GetClientSecret() string
- func (x *Credential) GetCreateAt() int64
- func (*Credential) ProtoMessage()
- func (x *Credential) ProtoReflect() protoreflect.Message
- func (x *Credential) Reset()
- func (x *Credential) String() string
- type DESCRIBE_BY
- func (DESCRIBE_BY) Descriptor() protoreflect.EnumDescriptor
- func (x DESCRIBE_BY) Enum() *DESCRIBE_BY
- func (DESCRIBE_BY) EnumDescriptor() ([]byte, []int)deprecated
- func (x DESCRIBE_BY) Number() protoreflect.EnumNumber
- func (x DESCRIBE_BY) String() string
- func (DESCRIBE_BY) Type() protoreflect.EnumType
- type DescribeServiceRequest
- func (*DescribeServiceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescribeServiceRequest) GetDescribeType() DESCRIBE_BY
- func (x *DescribeServiceRequest) GetDescribeValue() string
- func (*DescribeServiceRequest) ProtoMessage()
- func (x *DescribeServiceRequest) ProtoReflect() protoreflect.Message
- func (x *DescribeServiceRequest) Reset()
- func (x *DescribeServiceRequest) String() string
- type QueryServiceIdByClientIdRequest
- func (*QueryServiceIdByClientIdRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryServiceIdByClientIdRequest) GetClientId() string
- func (*QueryServiceIdByClientIdRequest) ProtoMessage()
- func (x *QueryServiceIdByClientIdRequest) ProtoReflect() protoreflect.Message
- func (x *QueryServiceIdByClientIdRequest) Reset()
- func (x *QueryServiceIdByClientIdRequest) String() string
- type QueryServiceRequest
- func (*QueryServiceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryServiceRequest) GetKeywords() string
- func (x *QueryServiceRequest) GetPage() *page.PageRequest
- func (*QueryServiceRequest) ProtoMessage()
- func (x *QueryServiceRequest) ProtoReflect() protoreflect.Message
- func (x *QueryServiceRequest) Reset()
- func (x *QueryServiceRequest) String() string
- type RPCClient
- type RPCServer
- type Service
- func (*Service) Descriptor() ([]byte, []int)deprecated
- func (x *Service) GetCredential() *Credential
- func (x *Service) GetMeta() *meta.Meta
- func (x *Service) GetSpec() *CreateServiceRequest
- func (*Service) ProtoMessage()
- func (x *Service) ProtoReflect() protoreflect.Message
- func (x *Service) Reset()
- func (x *Service) String() string
- type ServiceManager
- type ServiceSet
- type UnimplementedRPCServer
- func (UnimplementedRPCServer) DescribeService(context.Context, *DescribeServiceRequest) (*Service, error)
- func (UnimplementedRPCServer) QueryService(context.Context, *QueryServiceRequest) (*ServiceSet, error)
- func (UnimplementedRPCServer) QueryServiceIdByClientId(context.Context, *QueryServiceIdByClientIdRequest) (*Service, error)
- type UnsafeRPCServer
Constants ¶
const ( SERVICE_CLIENT_ID = "client_id" SERVICE_CLIENT_SECRET = "client_secret" )
定义context中的grpc认证头
const ( RPC_QueryService_FullMethodName = "/codehorse.mcenter.service.RPC/QueryService" RPC_DescribeService_FullMethodName = "/codehorse.mcenter.service.RPC/DescribeService" RPC_QueryServiceIdByClientId_FullMethodName = "/codehorse.mcenter.service.RPC/QueryServiceIdByClientId" )
const (
AppName = "service"
)
模块名称
Variables ¶
var ( DESCRIBE_BY_name = map[int32]string{ 0: "SERVICE_ID", 1: "SERVICE_CREDENTIAL_ID", } DESCRIBE_BY_value = map[string]int32{ "SERVICE_ID": 0, "SERVICE_CREDENTIAL_ID": 1, } )
Enum value maps for DESCRIBE_BY.
var File_apps_service_pb_rpc_proto protoreflect.FileDescriptor
var File_apps_service_pb_service_proto protoreflect.FileDescriptor
var RPC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "codehorse.mcenter.service.RPC", HandlerType: (*RPCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "QueryService", Handler: _RPC_QueryService_Handler, }, { MethodName: "DescribeService", Handler: _RPC_DescribeService_Handler, }, { MethodName: "QueryServiceIdByClientId", Handler: _RPC_QueryServiceIdByClientId_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/service/pb/rpc.proto", }
RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRPCServer ¶
func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
Types ¶
type CreateServiceRequest ¶
type CreateServiceRequest struct { // @gotags: bson:"domain" json:"domain" Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain" bson:"domain"` // @gotags: bson:"namespace" json:"namespace" Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" bson:"namespace"` // @gotags: bson:"name" json:"name" Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" bson:"name"` // contains filtered or unexported fields }
CreateServiceRequest结构体
func NewCreateServiceRequest ¶
func NewCreateServiceRequest() *CreateServiceRequest
CreateServiceRequest构造函数
func (*CreateServiceRequest) Descriptor
deprecated
func (*CreateServiceRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateServiceRequest.ProtoReflect.Descriptor instead.
func (*CreateServiceRequest) GetDomain ¶
func (x *CreateServiceRequest) GetDomain() string
func (*CreateServiceRequest) GetName ¶
func (x *CreateServiceRequest) GetName() string
func (*CreateServiceRequest) GetNamespace ¶
func (x *CreateServiceRequest) GetNamespace() string
func (*CreateServiceRequest) ProtoMessage ¶
func (*CreateServiceRequest) ProtoMessage()
func (*CreateServiceRequest) ProtoReflect ¶
func (x *CreateServiceRequest) ProtoReflect() protoreflect.Message
func (*CreateServiceRequest) Reset ¶
func (x *CreateServiceRequest) Reset()
func (*CreateServiceRequest) String ¶
func (x *CreateServiceRequest) String() string
type Credential ¶
type Credential struct { // @gotags: bson:"create_at" json:"create_at" CreateAt int64 `protobuf:"varint,1,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"` // @gotags: bson:"client_id" json:"client_id" ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"` // @gotags: bson:"client_secret" json:"client_secret" ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" bson:"client_secret"` // contains filtered or unexported fields }
Credential结构体
func (*Credential) Descriptor
deprecated
func (*Credential) Descriptor() ([]byte, []int)
Deprecated: Use Credential.ProtoReflect.Descriptor instead.
func (*Credential) GetClientId ¶
func (x *Credential) GetClientId() string
func (*Credential) GetClientSecret ¶
func (x *Credential) GetClientSecret() string
func (*Credential) GetCreateAt ¶
func (x *Credential) GetCreateAt() int64
func (*Credential) ProtoMessage ¶
func (*Credential) ProtoMessage()
func (*Credential) ProtoReflect ¶
func (x *Credential) ProtoReflect() protoreflect.Message
func (*Credential) Reset ¶
func (x *Credential) Reset()
func (*Credential) String ¶
func (x *Credential) String() string
type DESCRIBE_BY ¶
type DESCRIBE_BY int32
查询Service的枚举类型
const ( DESCRIBE_BY_SERVICE_ID DESCRIBE_BY = 0 DESCRIBE_BY_SERVICE_CREDENTIAL_ID DESCRIBE_BY = 1 )
func (DESCRIBE_BY) Descriptor ¶
func (DESCRIBE_BY) Descriptor() protoreflect.EnumDescriptor
func (DESCRIBE_BY) Enum ¶
func (x DESCRIBE_BY) Enum() *DESCRIBE_BY
func (DESCRIBE_BY) EnumDescriptor
deprecated
func (DESCRIBE_BY) EnumDescriptor() ([]byte, []int)
Deprecated: Use DESCRIBE_BY.Descriptor instead.
func (DESCRIBE_BY) Number ¶
func (x DESCRIBE_BY) Number() protoreflect.EnumNumber
func (DESCRIBE_BY) String ¶
func (x DESCRIBE_BY) String() string
func (DESCRIBE_BY) Type ¶
func (DESCRIBE_BY) Type() protoreflect.EnumType
type DescribeServiceRequest ¶
type DescribeServiceRequest struct { // @gotags: bson:"describe_type" json:"describe_type" DescribeType DESCRIBE_BY `` /* 152-byte string literal not displayed */ // @gotags: bson:"describe_value" json:"describe_value" DescribeValue string `protobuf:"bytes,2,opt,name=describe_value,json=describeValue,proto3" json:"describe_value" bson:"describe_value"` // contains filtered or unexported fields }
DescribeServiceRequest结构体
func NewDescribeServiceRequest ¶
func NewDescribeServiceRequest() *DescribeServiceRequest
DescribeServiceRequest构造函数
func (*DescribeServiceRequest) Descriptor
deprecated
func (*DescribeServiceRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribeServiceRequest.ProtoReflect.Descriptor instead.
func (*DescribeServiceRequest) GetDescribeType ¶
func (x *DescribeServiceRequest) GetDescribeType() DESCRIBE_BY
func (*DescribeServiceRequest) GetDescribeValue ¶
func (x *DescribeServiceRequest) GetDescribeValue() string
func (*DescribeServiceRequest) ProtoMessage ¶
func (*DescribeServiceRequest) ProtoMessage()
func (*DescribeServiceRequest) ProtoReflect ¶
func (x *DescribeServiceRequest) ProtoReflect() protoreflect.Message
func (*DescribeServiceRequest) Reset ¶
func (x *DescribeServiceRequest) Reset()
func (*DescribeServiceRequest) String ¶
func (x *DescribeServiceRequest) String() string
type QueryServiceIdByClientIdRequest ¶
type QueryServiceIdByClientIdRequest struct { // @gotags: bson:"client_id" json:"client_id" ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"` // contains filtered or unexported fields }
QueryServiceIdByClientIdRequest结构体
func NewQueryServiceIdByClientIdRequest ¶
func NewQueryServiceIdByClientIdRequest(clientid string) *QueryServiceIdByClientIdRequest
QueryServiceIdByClientIdRequest构造函数
func (*QueryServiceIdByClientIdRequest) Descriptor
deprecated
func (*QueryServiceIdByClientIdRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryServiceIdByClientIdRequest.ProtoReflect.Descriptor instead.
func (*QueryServiceIdByClientIdRequest) GetClientId ¶
func (x *QueryServiceIdByClientIdRequest) GetClientId() string
func (*QueryServiceIdByClientIdRequest) ProtoMessage ¶
func (*QueryServiceIdByClientIdRequest) ProtoMessage()
func (*QueryServiceIdByClientIdRequest) ProtoReflect ¶
func (x *QueryServiceIdByClientIdRequest) ProtoReflect() protoreflect.Message
func (*QueryServiceIdByClientIdRequest) Reset ¶
func (x *QueryServiceIdByClientIdRequest) Reset()
func (*QueryServiceIdByClientIdRequest) String ¶
func (x *QueryServiceIdByClientIdRequest) String() string
type QueryServiceRequest ¶
type QueryServiceRequest struct { // @gotags: bson:",inline" json:"page" Page *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page" bson:",inline"` // @gotags: bson:"keywords" json:"keywords" Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords" bson:"keywords"` // contains filtered or unexported fields }
QueryServiceRequest结构体
func (*QueryServiceRequest) Descriptor
deprecated
func (*QueryServiceRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryServiceRequest.ProtoReflect.Descriptor instead.
func (*QueryServiceRequest) GetKeywords ¶
func (x *QueryServiceRequest) GetKeywords() string
func (*QueryServiceRequest) GetPage ¶
func (x *QueryServiceRequest) GetPage() *page.PageRequest
func (*QueryServiceRequest) ProtoMessage ¶
func (*QueryServiceRequest) ProtoMessage()
func (*QueryServiceRequest) ProtoReflect ¶
func (x *QueryServiceRequest) ProtoReflect() protoreflect.Message
func (*QueryServiceRequest) Reset ¶
func (x *QueryServiceRequest) Reset()
func (*QueryServiceRequest) String ¶
func (x *QueryServiceRequest) String() string
type RPCClient ¶
type RPCClient interface { // 创建服务 // rpc CreateService(CreateServiceRequest) returns(Service); // 查询服务 QueryService(ctx context.Context, in *QueryServiceRequest, opts ...grpc.CallOption) (*ServiceSet, error) // 查询服务详情 DescribeService(ctx context.Context, in *DescribeServiceRequest, opts ...grpc.CallOption) (*Service, error) // 通过client id称找到service id QueryServiceIdByClientId(ctx context.Context, in *QueryServiceIdByClientIdRequest, opts ...grpc.CallOption) (*Service, error) }
RPCClient is the client API for RPC 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 NewRPCClient ¶
func NewRPCClient(cc grpc.ClientConnInterface) RPCClient
type RPCServer ¶
type RPCServer interface { // 创建服务 // rpc CreateService(CreateServiceRequest) returns(Service); // 查询服务 QueryService(context.Context, *QueryServiceRequest) (*ServiceSet, error) // 查询服务详情 DescribeService(context.Context, *DescribeServiceRequest) (*Service, error) // 通过client id称找到service id QueryServiceIdByClientId(context.Context, *QueryServiceIdByClientIdRequest) (*Service, error) // contains filtered or unexported methods }
RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility
type Service ¶
type Service struct { // @gotags: bson:",inline" json:"meta" Meta *meta.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"` // @gotags: bson:",inline" json:"spec" Spec *CreateServiceRequest `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"` // @gotags: bson:",inline" json:"credential" Credential *Credential `protobuf:"bytes,3,opt,name=credential,proto3" json:"credential" bson:",inline"` // contains filtered or unexported fields }
Service结构体
func (*Service) Descriptor
deprecated
func (*Service) GetCredential ¶
func (x *Service) GetCredential() *Credential
func (*Service) GetSpec ¶
func (x *Service) GetSpec() *CreateServiceRequest
func (*Service) ProtoMessage ¶
func (*Service) ProtoMessage()
func (*Service) ProtoReflect ¶
func (x *Service) ProtoReflect() protoreflect.Message
type ServiceManager ¶
type ServiceManager interface { // 创建服务 CreateService(context.Context, *CreateServiceRequest) (*Service, error) // 嵌套Service GRPC接口 RPCServer }
Service服务管理接口
type ServiceSet ¶
type ServiceSet struct { // @gotags: bson:"total" json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"` // @gotags: bson:"items" json:"items" Items []*Service `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"` // contains filtered or unexported fields }
ServiceSet结构体
func (*ServiceSet) Descriptor
deprecated
func (*ServiceSet) Descriptor() ([]byte, []int)
Deprecated: Use ServiceSet.ProtoReflect.Descriptor instead.
func (*ServiceSet) GetItems ¶
func (x *ServiceSet) GetItems() []*Service
func (*ServiceSet) GetTotal ¶
func (x *ServiceSet) GetTotal() int64
func (*ServiceSet) ProtoMessage ¶
func (*ServiceSet) ProtoMessage()
func (*ServiceSet) ProtoReflect ¶
func (x *ServiceSet) ProtoReflect() protoreflect.Message
func (*ServiceSet) Reset ¶
func (x *ServiceSet) Reset()
func (*ServiceSet) String ¶
func (x *ServiceSet) String() string
type UnimplementedRPCServer ¶
type UnimplementedRPCServer struct { }
UnimplementedRPCServer must be embedded to have forward compatible implementations.
func (UnimplementedRPCServer) DescribeService ¶
func (UnimplementedRPCServer) DescribeService(context.Context, *DescribeServiceRequest) (*Service, error)
func (UnimplementedRPCServer) QueryService ¶
func (UnimplementedRPCServer) QueryService(context.Context, *QueryServiceRequest) (*ServiceSet, error)
func (UnimplementedRPCServer) QueryServiceIdByClientId ¶
func (UnimplementedRPCServer) QueryServiceIdByClientId(context.Context, *QueryServiceIdByClientIdRequest) (*Service, error)
type UnsafeRPCServer ¶
type UnsafeRPCServer interface {
// contains filtered or unexported methods
}
UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.