Documentation
¶
Overview ¶
Package encoded contains wrappers that are used for binary payloads deserialization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataConverter ¶ added in v0.7.0
type DataConverter interface {
// ToData implements conversion of a list of values.
ToData(value ...interface{}) ([]byte, error)
// FromData implements conversion of an array of values of different types.
// Useful for deserializing arguments of function invocations.
FromData(input []byte, valuePtr ...interface{}) error
}
DataConverter is used by the framework to serialize/deserialize input and output of activity/workflow that need to be sent over the wire. To encode/decode workflow arguments, one should set DataConverter in two places:
- Workflow worker, through worker.Options
- Client, through client.Options
To encode/decode Activity/ChildWorkflow arguments, one should set DataConverter in two places:
- Inside workflow code, use workflow.WithDataConverter to create new Context,
and pass that context to ExecuteActivity/ExecuteChildWorkflow calls. Cadence support using different DataConverters for different activity/childWorkflow in same workflow.
- Activity/Workflow worker that run these activity/childWorkflow, through worker.Options.
type Value ¶
type Value interface {
// HasValue return whether there is value encoded.
HasValue() bool
// Get extract the encoded value into strong typed value pointer.
Get(valuePtr interface{}) error
}
Value is used to encapsulate/extract encoded value from workflow/activity.
type Values ¶
type Values interface {
// HasValues return whether there are values encoded.
HasValues() bool
// Get extract the encoded values into strong typed value pointers.
Get(valuePtr ...interface{}) error
}
Values is used to encapsulate/extract encoded one or more values from workflow/activity.