data_protocol

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataContentTypeJson = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudEvent

type CloudEvent struct {
	SpecVersion     string `json:"specversion"`
	ID              string `json:"id"`
	Type            string `json:"type"`
	Source          string `json:"source"`
	DataContentType string `json:"datacontenttype"`
	Time            string `json:"time"`
	Data            []byte `json:"data"`
}

func NewCloudEvent

func NewCloudEvent(eventID string, eventType string, source string, dataContentType string, data []byte) *CloudEvent

func NewCloudEventJson

func NewCloudEventJson(eventID string, eventType string, source string, obj any) (*CloudEvent, error)

func UnmarshalJsonCloudEvent

func UnmarshalJsonCloudEvent(cloudEventJsonBytes []byte) (*CloudEvent, error)

func (*CloudEvent) MarshalJson

func (event *CloudEvent) MarshalJson() ([]byte, error)

Jump to

Keyboard shortcuts

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