Documentation
¶
Index ¶
- func GetRegistry() map[string]ServiceInvocationModule
- func RegisterAsDaprModule(app string, svcHolder any, args ...map[string]DaprServiceInvocationHandler) error
- type DaprModule
- func (m *DaprModule) DiscoverHandlers(args ...HandlerMatch) (map[string]any, error)
- func (m *DaprModule) GetHandlers() map[string]any
- func (b DaprModule) GetName() string
- func (m *DaprModule) GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error)
- func (m *DaprModule) GetRoutes(srcPath string, args ...HandlerMatch) ([]*Route, error)
- func (m *DaprModule) RegisterHandlers(handlers map[string]any) error
- func (m *DaprModule) ValidateHandler(handlerName string, handler any) error
- type DaprServiceInvocationHandler
- type HandlerMatch
- type Option
- type Permission
- type PermissionAnnotation
- type Route
- type RouteAnnotation
- type ServiceInvocationModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRegistry ¶
func GetRegistry() map[string]ServiceInvocationModule
func RegisterAsDaprModule ¶
func RegisterAsDaprModule(app string, svcHolder any, args ...map[string]DaprServiceInvocationHandler) error
Types ¶
type DaprModule ¶
type DaprModule struct {
// contains filtered or unexported fields
}
DaprModule 服务模块的方法信息
func (*DaprModule) DiscoverHandlers ¶
func (m *DaprModule) DiscoverHandlers(args ...HandlerMatch) (map[string]any, error)
DiscoverHandlers 获取Module作为receiver的所有MethodMatchFunction匹配的方法, MethodMatchFunction生成新的方法名和判断是否匹配
func (*DaprModule) GetHandlers ¶
func (m *DaprModule) GetHandlers() map[string]any
GetHandlers 获取手动注册的handlers
func (*DaprModule) GetPermissions ¶
func (m *DaprModule) GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error)
GetPermissions 获取权限
func (*DaprModule) GetRoutes ¶
func (m *DaprModule) GetRoutes(srcPath string, args ...HandlerMatch) ([]*Route, error)
GetRoutes 获取路由
func (*DaprModule) RegisterHandlers ¶
func (m *DaprModule) RegisterHandlers(handlers map[string]any) error
func (*DaprModule) ValidateHandler ¶
func (m *DaprModule) ValidateHandler(handlerName string, handler any) error
type HandlerMatch ¶
type Option ¶
type Option func(module ServiceInvocationModule) ServiceInvocationModule
type Permission ¶
type PermissionAnnotation ¶
type RouteAnnotation ¶
type ServiceInvocationModule ¶
type ServiceInvocationModule interface {
GetName() string
GetRoutes(srcPath string, args ...HandlerMatch) ([]*Route, error)
DiscoverHandlers(args ...HandlerMatch) (map[string]any, error) // 通过反射发现Handlers
RegisterHandlers(handlers map[string]any) error
GetHandlers() map[string]any // 获取手动注册的handlers
ValidateHandler(name string, handler any) error
GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error)
}
func NewDaprModule ¶
func NewDaprModule(app string, svcHolder any, options ...Option) (ServiceInvocationModule, error)
Click to show internal directories.
Click to hide internal directories.