payload

package
v1.26.0-120.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(p *commonpb.Payload, valuePtr interface{}) error

func Encode

func Encode(value interface{}) (*commonpb.Payload, error)

func EncodeBytes

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

func EncodeString

func EncodeString(str string) *commonpb.Payload

func MergeMapOfPayload added in v1.18.0

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