payload

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(p *commonpb.Payload, valuePtr any) error

func Encode

func Encode(value any) (*commonpb.Payload, error)

func EncodeBytes

func EncodeBytes(bytes []byte) *commonpb.Payload

func EncodeString

func EncodeString(str string) *commonpb.Payload

func FilterNilMemo

func FilterNilMemo(memo *commonpb.Memo) *commonpb.Memo

FilterNilMemo returns a new Memo with nil/empty payload values filtered out. If the input is nil or all values are nil/empty, returns nil. This is used to filter out nil memo fields from workflow start, continue-as-new, and modify-properties events. Reuses MergeMapOfPayload which already handles nil payload filtering.

func FilterNilSearchAttributes

func FilterNilSearchAttributes(sa *commonpb.SearchAttributes) *commonpb.SearchAttributes

FilterNilSearchAttributes returns a new SearchAttributes with nil/empty payload values filtered out. If the input is nil or all values are nil/empty, returns nil. This is used to filter out nil search attributes from workflow start and continue-as-new events. Reuses MergeMapOfPayload which already handles nil payload filtering.

func MergeMapOfPayload

func MergeMapOfPayload(
	dst map[string]*commonpb.Payload,
	src map[string]*commonpb.Payload,
) map[string]*commonpb.Payload

MergeMapOfPayload returns a new map resulting from merging map `src` into `dst`. If a key in `src` already exists in `dst`, then the value in `src` replaces the value in `dst`. If a key in `src` has nil or empty slice payload value, then it deletes the key from `dst` if it exists. For example:

dst := map[string]*commonpb.Payload{
	"key1": EncodeString("value1"),
	"key2": EncodeString("value2"),
}
src := map[string]*commonpb.Payload{
	"key1": EncodeString("newValue1"),
	"key2": nilPayload,
}
res := MergeMapOfPayload(dst, src)

The resulting map `res` is:

map[string]*commonpb.Payload{
	"key1": EncodeString("newValue1"),
}

func ToString

func ToString(p *commonpb.Payload) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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