cloudevents

package
v0.0.0-...-19f89c5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationJson DataContentType = "application/json"
	V102            SpecVersion     = "1.0.2"
)

Variables

This section is empty.

Functions

func ValidatePayload

func ValidatePayload(p KafkaEnvelope) error

Types

type DataContentType

type DataContentType string

func (DataContentType) IsValid

func (dct DataContentType) IsValid() error

type Envelope

type Envelope[D any] struct {
	SpecVersion     SpecVersion     `json:"specversion"`
	Type            string          `json:"type"`
	Source          URI             `json:"source"`
	Id              string          `json:"id"`
	Time            time.Time       `json:"time"`
	DataContentType DataContentType `json:"datacontenttype"`
	Data            D               `json:"data"`
}

TODO: Specify accepted data payload data type is generic, we accept any valid JSON for now

func WrapPayload

func WrapPayload[P any](payload P, source URI, id string, messageType string) Envelope[P]

type KafkaEnvelope

type KafkaEnvelope struct {
	Envelope[connectionhub.WsMessage]
}

type SpecVersion

type SpecVersion string

func (SpecVersion) IsValid

func (sv SpecVersion) IsValid() error

type URI

type URI string

func (URI) IsValid

func (uri URI) IsValid() error

Jump to

Keyboard shortcuts

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