dapr

package
v0.0.1-202203291750 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeJson = "application/json"

Variables

View Source
var DefaultApiError = ApiError{
	Code: 1,
	Msg:  "api error",
}

Functions

func DeleteState

func DeleteState(storeName, key string) error

DeleteState 删除状态

func Error

func Error(event *common.InvocationEvent, e error) (*common.Content, error)

Error Reply with response

func GetMetaValue

func GetMetaValue(ctx context.Context, key string) string

GetMetaValue get the first grpc meta value

func GetMetaValues

func GetMetaValues(ctx context.Context, key string) []string

GetMetaValues get grpc meta values

func GetState

func GetState(storeName, key string) ([]byte, error)

GetState 保存状态

func InvokeService

func InvokeService(appId, methodName string, data interface{}, args ...string) ([]byte, error)

InvokeService 调用dapr服务

func InvokeServiceWithClient

func InvokeServiceWithClient(daprClient client.Client, appId, methodName string, data interface{}, args ...string) ([]byte, error)

InvokeServiceWithClient 需要传入daprClient去调用

func Publish

func Publish(pubSubName, topic string, data interface{}) error

Publish 发布消息

func SaveState

func SaveState(storeName, key string, data interface{}) error

SaveState 保存状态

func Success

func Success(event *common.InvocationEvent, resp interface{}) (*common.Content, error)

Success reply with success response

Types

type ApiError

type ApiError struct {
	Code int
	Msg  string
}

ApiError 默认的错误结构

Jump to

Keyboard shortcuts

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