Documentation
¶
Index ¶
- Constants
- func DeleteState(storeName, key string) error
- func Error(err error) (*common.Content, error)
- func GetInvocationHandlers(registry map[string]*ServiceModule) map[string]common.ServiceInvocationHandler
- func GetMetaValue(ctx context.Context, key string) string
- func GetMetaValues(ctx context.Context, key string) []string
- func GetState(storeName, key string) ([]byte, error)
- func Invoke(appId string, version int, namespace, method string, data interface{}, ...) ([]byte, error)
- func InvokeWithClient(appId string, version int, namespace, client, method string, data interface{}, ...) ([]byte, error)
- func Publish(pubSubName, topic string, data interface{}, args ...bool) error
- func RegisterHandlers(app string, module interface{}, ...) error
- func SaveState(storeName, key string, value interface{}) error
- func Success(event *common.InvocationEvent, resp interface{}) (*common.Content, error)
- type Event
- type ServiceModule
- type ServiceModuleRoute
Constants ¶
View Source
const ContentTypeJson = "application/json"
Variables ¶
This section is empty.
Functions ¶
func GetInvocationHandlers ¶ added in v1.0.17
func GetInvocationHandlers(registry map[string]*ServiceModule) map[string]common.ServiceInvocationHandler
GetInvocationHandlers 从注册中心获取Dapr InvocationHandler
func GetMetaValue ¶
GetMetaValue get the first grpc meta value
func GetMetaValues ¶
GetMetaValues get grpc meta values
func Invoke ¶
func Invoke(appId string, version int, namespace, method string, data interface{}, args ...string) ([]byte, error)
Invoke 调用dapr服务
func InvokeWithClient ¶
func InvokeWithClient(appId string, version int, namespace, client, method string, data interface{}, args ...string) ([]byte, error)
InvokeWithClient 调用dapr服务
func RegisterHandlers ¶
func RegisterHandlers(app string, module interface{}, methods map[string]common.ServiceInvocationHandler, registry map[string]*ServiceModule) error
RegisterHandlers register handlers to global registry
Types ¶
type Event ¶
type Event struct {
Subscription *common.Subscription
Handler common.TopicEventHandler
}
type ServiceModule ¶ added in v1.0.17
type ServiceModule struct {
// contains filtered or unexported fields
}
func (*ServiceModule) GetAnnotations ¶ added in v1.0.17
func (sm *ServiceModule) GetAnnotations(args ...string) ([]*serviceModuleHandlerAnnotation, error)
GetAnnotations 解析服务模块中的所有注解和注释 handlerName=>*serviceModuleHandlerAnnotation
func (*ServiceModule) GetRoutes ¶ added in v1.0.17
func (sm *ServiceModule) GetRoutes(args ...string) ([]*ServiceModuleRoute, error)
GetRoutes 获取路由
type ServiceModuleRoute ¶ added in v1.0.17
type ServiceModuleRoute struct {
App string // app name
Handler string // dapr method
Namespace string // namespace
Version int // version
Endpoint string // endpoint
Methods []string // http methods
CallerId int64 // 第三方回调应用id
IsRawResponse bool // 是否返回原始消息
IsPublic bool // 是否是公共方法
Comments []string // 备注
}
Click to show internal directories.
Click to hide internal directories.