format

package module
v2.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 18

Documentation

Index

Constants

View Source
const (
	ApplicationCloudEventsProtobuf = "application/cloudevents+protobuf"
)
View Source
const (
	// ContentTypeProtobuf indicates that the data attribute is a protobuf
	// message.
	ContentTypeProtobuf = "application/protobuf"
)

Variables

View Source
var (

	// Protobuf is the built-in "application/cloudevents+protobuf" format.
	Protobuf = protobufFmt{}
)

Functions

func DecodeData

func DecodeData(ctx context.Context, in []byte, out interface{}) error

DecodeData converts an encoded protobuf message back into the message (out). The message must be a type compatible with whatever was given to EncodeData.

func EncodeData

func EncodeData(ctx context.Context, in interface{}) ([]byte, error)

EncodeData a protobuf message to bytes.

Like the official datacodec implementations, this one returns the given value as-is if it is already a byte slice.

func FromProto added in v2.9.0

func FromProto(container *pb.CloudEvent) (*event.Event, error)

Convert from a protobuf variant into the generic, SDK event.

func StringOfApplicationCloudEventsProtobuf

func StringOfApplicationCloudEventsProtobuf() *string

StringOfApplicationCloudEventsProtobuf returns a string pointer to "application/cloudevents+protobuf"

func ToProto added in v2.9.0

func ToProto(e *event.Event) (*pb.CloudEvent, error)

convert an SDK event to a protobuf variant of the event that can be marshaled.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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