payload

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 4 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(
	m1 map[string]*commonpb.Payload,
	m2 map[string]*commonpb.Payload,
) map[string]*commonpb.Payload

MergeMapOfPayload returns a new map resulting from merging map m2 into m1. If a key in m2 already exists in m1, then the value in m2 replaces the value in m1. If the new payload have nil data or an empty slice data, then it deletes the key. For example:

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

The resulting map `m3` is:

m1 := 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