Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
- type DeleteRoleRequest
- type DescRoleRequest
- type Meta
- type QueryRoleRequest
- func (*QueryRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRoleRequest) GetKeyword() string
- func (x *QueryRoleRequest) GetPageNum() int64
- func (x *QueryRoleRequest) GetPageSize() int64
- func (x *QueryRoleRequest) GetQueryType() QueryType
- func (*QueryRoleRequest) ProtoMessage()
- func (x *QueryRoleRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRoleRequest) Reset()
- func (x *QueryRoleRequest) String() string
- type QueryType
- type Role
- type RoleSet
- func (*RoleSet) Descriptor() ([]byte, []int)deprecated
- func (x *RoleSet) GetItems() []*Role
- func (x *RoleSet) GetTotal() int64
- func (*RoleSet) ProtoMessage()
- func (x *RoleSet) ProtoReflect() protoreflect.Message
- func (x *RoleSet) Reset()
- func (x *RoleSet) String() string
- func (rs *RoleSet) ValidatePermission(v, s, a string) bool
- type RpcClient
- type RpcServer
- type Service
- type Spec
- func (*Spec) Descriptor() ([]byte, []int)deprecated
- func (x *Spec) GetActions() []string
- func (x *Spec) GetDescription() string
- func (x *Spec) GetName() string
- func (x *Spec) GetNamespace() string
- func (x *Spec) GetResource() []string
- func (x *Spec) GetService() []string
- func (*Spec) ProtoMessage()
- func (x *Spec) ProtoReflect() protoreflect.Message
- func (x *Spec) Reset()
- func (x *Spec) String() string
- type UnimplementedRpcServer
- func (UnimplementedRpcServer) CreateRole(context.Context, *Spec) (*Role, error)
- func (UnimplementedRpcServer) DeleteRole(context.Context, *DeleteRoleRequest) (*Role, error)
- func (UnimplementedRpcServer) DescRole(context.Context, *DescRoleRequest) (*Role, error)
- func (UnimplementedRpcServer) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
- type UnsafeRpcServer
Constants ¶
const ( Rpc_CreateRole_FullMethodName = "/mcenter.role.Rpc/CreateRole" Rpc_DescRole_FullMethodName = "/mcenter.role.Rpc/DescRole" Rpc_QueryRole_FullMethodName = "/mcenter.role.Rpc/QueryRole" Rpc_DeleteRole_FullMethodName = "/mcenter.role.Rpc/DeleteRole" )
const AppName = "role"
Variables ¶
var ( QueryType_name = map[int32]string{ 0: "QUERY_TYPE_UNSPECIFIED", 1: "QUERY_TYPE_ROLE_NAME", 2: "QUERY_TYPE_DESC", 3: "QUERY_TYPE_ROLE_IDS", } QueryType_value = map[string]int32{ "QUERY_TYPE_UNSPECIFIED": 0, "QUERY_TYPE_ROLE_NAME": 1, "QUERY_TYPE_DESC": 2, "QUERY_TYPE_ROLE_IDS": 3, } )
Enum value maps for QueryType.
var File_apps_role_pb_model_proto protoreflect.FileDescriptor
var File_apps_role_pb_rpc_proto protoreflect.FileDescriptor
var Rpc_ServiceDesc = grpc.ServiceDesc{ ServiceName: "mcenter.role.Rpc", HandlerType: (*RpcServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateRole", Handler: _Rpc_CreateRole_Handler, }, { MethodName: "DescRole", Handler: _Rpc_DescRole_Handler, }, { MethodName: "QueryRole", Handler: _Rpc_QueryRole_Handler, }, { MethodName: "DeleteRole", Handler: _Rpc_DeleteRole_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/role/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 DeleteRoleRequest ¶
type DeleteRoleRequest struct { // @gotags: validate:"required" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" validate:"required"` // contains filtered or unexported fields }
func (*DeleteRoleRequest) Descriptor
deprecated
func (*DeleteRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRoleRequest.ProtoReflect.Descriptor instead.
func (*DeleteRoleRequest) GetId ¶
func (x *DeleteRoleRequest) GetId() int64
func (*DeleteRoleRequest) ProtoMessage ¶
func (*DeleteRoleRequest) ProtoMessage()
func (*DeleteRoleRequest) ProtoReflect ¶
func (x *DeleteRoleRequest) ProtoReflect() protoreflect.Message
func (*DeleteRoleRequest) Reset ¶
func (x *DeleteRoleRequest) Reset()
func (*DeleteRoleRequest) String ¶
func (x *DeleteRoleRequest) String() string
type DescRoleRequest ¶
type DescRoleRequest struct { // @gotags: validate:"required" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" validate:"required"` // contains filtered or unexported fields }
func (*DescRoleRequest) Descriptor
deprecated
func (*DescRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescRoleRequest.ProtoReflect.Descriptor instead.
func (*DescRoleRequest) GetId ¶
func (x *DescRoleRequest) GetId() int64
func (*DescRoleRequest) ProtoMessage ¶
func (*DescRoleRequest) ProtoMessage()
func (*DescRoleRequest) ProtoReflect ¶
func (x *DescRoleRequest) ProtoReflect() protoreflect.Message
func (*DescRoleRequest) Reset ¶
func (x *DescRoleRequest) Reset()
func (*DescRoleRequest) String ¶
func (x *DescRoleRequest) String() string
type Meta ¶
type Meta struct { // @gotags: json:"created_at" gorm:"primaryKey" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"created_at" gorm:"primaryKey"` // @gotags: json:"created_at" gorm:"autoCreateTime" CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at" gorm:"autoCreateTime"` // @gotags: json:"updated_at" gorm:"autoUpdateTime" UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at" gorm:"autoUpdateTime"` // contains filtered or unexported fields }
func (*Meta) Descriptor
deprecated
func (*Meta) GetCreatedAt ¶
func (*Meta) GetUpdatedAt ¶
func (*Meta) ProtoMessage ¶
func (*Meta) ProtoMessage()
func (*Meta) ProtoReflect ¶
func (x *Meta) ProtoReflect() protoreflect.Message
type QueryRoleRequest ¶
type QueryRoleRequest struct { // @gotags: validate:"required" PageNum int64 `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty" validate:"required"` // @gotags: validate:"required" PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty" validate:"required"` QueryType QueryType `protobuf:"varint,3,opt,name=query_type,json=queryType,proto3,enum=mcenter.role.QueryType" json:"query_type,omitempty"` Keyword string `protobuf:"bytes,4,opt,name=keyword,proto3" json:"keyword,omitempty"` // contains filtered or unexported fields }
func (*QueryRoleRequest) Descriptor
deprecated
func (*QueryRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.
func (*QueryRoleRequest) GetKeyword ¶
func (x *QueryRoleRequest) GetKeyword() string
func (*QueryRoleRequest) GetPageNum ¶
func (x *QueryRoleRequest) GetPageNum() int64
func (*QueryRoleRequest) GetPageSize ¶
func (x *QueryRoleRequest) GetPageSize() int64
func (*QueryRoleRequest) GetQueryType ¶
func (x *QueryRoleRequest) GetQueryType() QueryType
func (*QueryRoleRequest) ProtoMessage ¶
func (*QueryRoleRequest) ProtoMessage()
func (*QueryRoleRequest) ProtoReflect ¶
func (x *QueryRoleRequest) ProtoReflect() protoreflect.Message
func (*QueryRoleRequest) Reset ¶
func (x *QueryRoleRequest) Reset()
func (*QueryRoleRequest) String ¶
func (x *QueryRoleRequest) String() string
type QueryType ¶
type QueryType int32
func (QueryType) Descriptor ¶
func (QueryType) Descriptor() protoreflect.EnumDescriptor
func (QueryType) EnumDescriptor
deprecated
func (QueryType) Number ¶
func (x QueryType) Number() protoreflect.EnumNumber
func (QueryType) Type ¶
func (QueryType) Type() protoreflect.EnumType
type Role ¶
type Role struct { // @gotags: gorm:"embedded" Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty" gorm:"embedded"` // @gotags: gorm:"embedded" Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty" gorm:"embedded"` // contains filtered or unexported fields }
func (*Role) Descriptor
deprecated
func (*Role) ProtoMessage ¶
func (*Role) ProtoMessage()
func (*Role) ProtoReflect ¶
func (x *Role) ProtoReflect() protoreflect.Message
type RoleSet ¶
type RoleSet struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Items []*Role `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*RoleSet) Descriptor
deprecated
func (*RoleSet) ProtoMessage ¶
func (*RoleSet) ProtoMessage()
func (*RoleSet) ProtoReflect ¶
func (x *RoleSet) ProtoReflect() protoreflect.Message
func (*RoleSet) ValidatePermission ¶
ValidatePermission 校验给定的 service、resource、action 是否在权限允许的范围之内
type RpcClient ¶
type RpcClient interface { CreateRole(ctx context.Context, in *Spec, opts ...grpc.CallOption) (*Role, error) DescRole(ctx context.Context, in *DescRoleRequest, opts ...grpc.CallOption) (*Role, error) QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, error) DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*Role, 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 { CreateRole(context.Context, *Spec) (*Role, error) DescRole(context.Context, *DescRoleRequest) (*Role, error) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error) DeleteRole(context.Context, *DeleteRoleRequest) (*Role, error) // contains filtered or unexported methods }
RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility
type Spec ¶
type Spec struct { // @gotags: json:"name" validate:"required" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" validate:"required"` // @gotags: json:"namespace" validate:"required" Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" validate:"required"` // @gotags: json:"service" validate:"required" gorm:"json" Service []string `protobuf:"bytes,3,rep,name=service,proto3" json:"service" validate:"required" gorm:"json"` // @gotags: json:"resource" validate:"required" gorm:"json" Resource []string `protobuf:"bytes,4,rep,name=resource,proto3" json:"resource" validate:"required" gorm:"json"` // @gotags: json:"actions" validate:"required" gorm:"json" Actions []string `protobuf:"bytes,5,rep,name=actions,proto3" json:"actions" validate:"required" gorm:"json"` // @gotags: json:"description" validate:"required" Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description" validate:"required"` // contains filtered or unexported fields }
func (*Spec) Descriptor
deprecated
func (*Spec) GetActions ¶
func (*Spec) GetDescription ¶
func (*Spec) GetNamespace ¶
func (*Spec) GetResource ¶
func (*Spec) GetService ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) ProtoReflect ¶
func (x *Spec) ProtoReflect() protoreflect.Message
type UnimplementedRpcServer ¶
type UnimplementedRpcServer struct { }
UnimplementedRpcServer must be embedded to have forward compatible implementations.
func (UnimplementedRpcServer) CreateRole ¶
func (UnimplementedRpcServer) DeleteRole ¶
func (UnimplementedRpcServer) DeleteRole(context.Context, *DeleteRoleRequest) (*Role, error)
func (UnimplementedRpcServer) DescRole ¶
func (UnimplementedRpcServer) DescRole(context.Context, *DescRoleRequest) (*Role, error)
func (UnimplementedRpcServer) QueryRole ¶
func (UnimplementedRpcServer) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, 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.