Documentation
¶
Index ¶
- Constants
- Variables
- func GetInvocationModules() map[string]InvocationModule
- func RegisterAsDaprModule(app string, svcHolder any, args ...map[string]DaprInvocationHandler) error
- type BaseGenerator
- type DaprInvocationHandler
- type DaprInvocationModule
- func (m *DaprInvocationModule) DiscoverHandlers(args ...HandlerMatch) (map[string]any, error)
- func (m *DaprInvocationModule) GetHandlers() map[string]any
- func (b DaprInvocationModule) GetName() string
- func (m *DaprInvocationModule) GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error)
- func (m *DaprInvocationModule) GetRoutes(srcPath string, args ...HandlerMatch) ([]*Route, error)
- func (b DaprInvocationModule) RegisterHandlers(handlers map[string]any) error
- func (m *DaprInvocationModule) ValidateHandler(handler any) error
- type DaprService
- type Generator
- type HandlerMatch
- type InvocationModule
- type Option
- type Permission
- type PermissionAnnotation
- type Route
- type RouteAnnotation
- type Service
Constants ¶
View Source
const ( MetaPrefix = "Hd-" MetaAppId = MetaPrefix + "App-Id" MetaVersion = MetaPrefix + "Version" )
Variables ¶
View Source
var ( // AllMetaKeys 所有meta的关键字 AllMetaKeys = []string{ MetaAppId, MetaVersion, } )
Functions ¶
func GetInvocationModules ¶ added in v1.0.53
func GetInvocationModules() map[string]InvocationModule
func RegisterAsDaprModule ¶
func RegisterAsDaprModule(app string, svcHolder any, args ...map[string]DaprInvocationHandler) error
Types ¶
type BaseGenerator ¶ added in v1.0.51
type BaseGenerator struct { }
func (*BaseGenerator) Gen ¶ added in v1.0.51
func (m *BaseGenerator) Gen(srcPath string) error
func (*BaseGenerator) Get ¶ added in v1.0.53
func (m *BaseGenerator) Get() any
func (*BaseGenerator) Register ¶ added in v1.0.51
func (m *BaseGenerator) Register() error
type DaprInvocationHandler ¶ added in v1.0.54
type DaprInvocationModule ¶ added in v1.0.53
type DaprInvocationModule struct {
// contains filtered or unexported fields
}
DaprInvocationModule 服务模块的方法信息
func (*DaprInvocationModule) DiscoverHandlers ¶ added in v1.0.53
func (m *DaprInvocationModule) DiscoverHandlers(args ...HandlerMatch) (map[string]any, error)
DiscoverHandlers 获取Module作为receiver的所有MethodMatchFunction匹配的方法, MethodMatchFunction生成新的方法名和判断是否匹配
func (*DaprInvocationModule) GetHandlers ¶ added in v1.0.53
func (m *DaprInvocationModule) GetHandlers() map[string]any
GetHandlers 将map[string]*invocationHandler转换成map[string]common.serviceHandler
func (DaprInvocationModule) GetName ¶ added in v1.0.53
func (b DaprInvocationModule) GetName() string
func (*DaprInvocationModule) GetPermissions ¶ added in v1.0.53
func (m *DaprInvocationModule) GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error)
GetPermissions 获取权限
func (*DaprInvocationModule) GetRoutes ¶ added in v1.0.53
func (m *DaprInvocationModule) GetRoutes(srcPath string, args ...HandlerMatch) ([]*Route, error)
GetRoutes 获取路由
func (DaprInvocationModule) RegisterHandlers ¶ added in v1.0.53
RegisterHandlers 参数handlers为alias=>receiver.method, 保存为handler.id=>*invocationHandler
func (*DaprInvocationModule) ValidateHandler ¶ added in v1.0.53
func (m *DaprInvocationModule) ValidateHandler(handler any) error
type DaprService ¶ added in v1.0.51
type DaprService interface { Service GetInvocationHandlers() map[string]common.ServiceInvocationHandler GetBindingHandlers() map[string]common.BindingInvocationHandler GetEvents() []dapr.Event }
func NewDaprService ¶ added in v1.0.51
func NewDaprService() DaprService
type Generator ¶ added in v1.0.51
type Generator interface { Register() error // 通过生成的源文件来注册相关信息 Gen(srcPath string) error // 通过解析源代码来生成源文件 Get() any // 获取生成的内容 }
func NewGenerator ¶ added in v1.0.51
func NewGenerator() Generator
type HandlerMatch ¶
type InvocationModule ¶ added in v1.0.53
type InvocationModule 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(handler any) error GetPermissions(srcPath string, args ...HandlerMatch) ([]*Permission, error) }
func NewDaprInvocationModule ¶ added in v1.0.53
func NewDaprInvocationModule(app string, svcHolder any, options ...Option) (InvocationModule, error)
type Option ¶
type Option func(module InvocationModule) InvocationModule
type Permission ¶
type PermissionAnnotation ¶
type RouteAnnotation ¶
Click to show internal directories.
Click to hide internal directories.