role

package
v0.0.0-...-2c311f4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 10 Imported by: 0

README

角色管理

Documentation

Index

Constants

View Source
const (
	AppName = "roles"
)

Variables

View Source
var File_apps_role_pb_role_proto protoreflect.FileDescriptor
View Source
var File_apps_role_pb_rpc_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go9.devcloud.role.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryRole",
			Handler:    _RPC_QueryRole_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 CreateRoleRequest

type CreateRoleRequest struct {

	// 角色名称
	// @gotags: bson:"name" json:"name"
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" bson:"name"`
	// 角色功能列表
	// @gotags: bson:"features" json:"features"
	Features []*Feature `protobuf:"bytes,2,rep,name=features,proto3" json:"features" bson:"features"`
	// contains filtered or unexported fields
}

包含服务的功能

func NewCreateRoleRequest

func NewCreateRoleRequest() *CreateRoleRequest

func (*CreateRoleRequest) AddFeature

func (req *CreateRoleRequest) AddFeature(f *Feature)

func (*CreateRoleRequest) Descriptor deprecated

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

Deprecated: Use CreateRoleRequest.ProtoReflect.Descriptor instead.

func (*CreateRoleRequest) GetFeatures

func (x *CreateRoleRequest) GetFeatures() []*Feature

func (*CreateRoleRequest) GetName

func (x *CreateRoleRequest) GetName() string

func (*CreateRoleRequest) ProtoMessage

func (*CreateRoleRequest) ProtoMessage()

func (*CreateRoleRequest) ProtoReflect

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

func (*CreateRoleRequest) Reset

func (x *CreateRoleRequest) Reset()

func (*CreateRoleRequest) String

func (x *CreateRoleRequest) String() string

type Feature

type Feature struct {
	ServiceId  string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	HttpMethod string `protobuf:"bytes,2,opt,name=http_method,json=httpMethod,proto3" json:"http_method,omitempty"`
	HttPath    string `protobuf:"bytes,3,opt,name=htt_path,json=httPath,proto3" json:"htt_path,omitempty"`
	// contains filtered or unexported fields
}

一个功能

func (*Feature) Descriptor deprecated

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

Deprecated: Use Feature.ProtoReflect.Descriptor instead.

func (*Feature) GetHttPath

func (x *Feature) GetHttPath() string

func (*Feature) GetHttpMethod

func (x *Feature) GetHttpMethod() string

func (*Feature) GetServiceId

func (x *Feature) GetServiceId() string

func (*Feature) IsEqual

func (f *Feature) IsEqual(serviceId, httpMethod, httpPath string) bool

func (*Feature) ProtoMessage

func (*Feature) ProtoMessage()

func (*Feature) ProtoReflect

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

func (*Feature) Reset

func (x *Feature) Reset()

func (*Feature) String

func (x *Feature) String() string

type QueryRoleRequest

type QueryRoleRequest struct {

	// 分页参数
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"`
	// role id的列表
	RoleIds []string `protobuf:"bytes,2,rep,name=role_ids,json=roleIds,proto3" json:"role_ids,omitempty"`
	// contains filtered or unexported fields
}

func NewQueryRoleRequest

func NewQueryRoleRequest() *QueryRoleRequest

func (*QueryRoleRequest) AddRoleId

func (req *QueryRoleRequest) AddRoleId(ids ...string)

func (*QueryRoleRequest) Descriptor deprecated

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

Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.

func (*QueryRoleRequest) GetPage

func (x *QueryRoleRequest) GetPage() *request.PageRequest

func (*QueryRoleRequest) GetRoleIds

func (x *QueryRoleRequest) GetRoleIds() []string

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 RPCClient

type RPCClient interface {
	// 查询角色列表
	QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, 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 {
	// 查询角色列表
	QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
	// contains filtered or unexported methods
}

RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility

type Role

type Role 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 *CreateRoleRequest `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"`
	// contains filtered or unexported fields
}

func New

func New(req *CreateRoleRequest) *Role

func NewDefaultRole

func NewDefaultRole() *Role

func (*Role) Descriptor deprecated

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

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetMeta

func (x *Role) GetMeta() *meta.Meta

func (*Role) GetSpec

func (x *Role) GetSpec() *CreateRoleRequest

func (*Role) HasFeatrue

func (r *Role) HasFeatrue(serviceId, httpMethod, httpPath string) bool

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) ProtoReflect

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

func (*Role) Reset

func (x *Role) Reset()

func (*Role) String

func (x *Role) String() string

type RoleSet

type RoleSet struct {

	// 用户总数量
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 分页的用户列表
	// @gotags: json:"items"
	Items []*Role `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

func NewRoleSet

func NewRoleSet() *RoleSet

func (*RoleSet) Add

func (s *RoleSet) Add(item *Role)

func (*RoleSet) Descriptor deprecated

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

Deprecated: Use RoleSet.ProtoReflect.Descriptor instead.

func (*RoleSet) GetItems

func (x *RoleSet) GetItems() []*Role

func (*RoleSet) GetTotal

func (x *RoleSet) GetTotal() int64

func (*RoleSet) ProtoMessage

func (*RoleSet) ProtoMessage()

func (*RoleSet) ProtoReflect

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

func (*RoleSet) Reset

func (x *RoleSet) Reset()

func (*RoleSet) String

func (x *RoleSet) String() string

type Service

type Service interface {
	// 创建角色
	CreateRole(context.Context, *CreateRoleRequest) (*Role, error)
	RPCServer
}

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) QueryRole

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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