cloudevents

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultEncoding = ce.Binary
	DefaultSource   = "http://knative.test"
	DefaultType     = "dev.knative.test.event"
)

CloudEvent related constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseData

type BaseData struct {
	Sequence int    `json:"id"`
	Message  string `json:"message"`
}

BaseData defines a simple struct that can be used as data of a CloudEvent.

type CloudEvent

type CloudEvent struct {
	ce.EventContextV1        // use cloud events v1 context
	Data              string // must be in json format
	Encoding          string // binary or structured
}

CloudEvent specifies the arguments for a CloudEvent used as input to create a new container in test.

func New

func New(data string, options ...Option) *CloudEvent

New returns a new CloudEvent with most preset default properties.

type Option

type Option func(*CloudEvent)

Option enables further configuration of a CloudEvent.

func WithEncoding

func WithEncoding(encoding string) Option

WithType returns an option that changes the encoding for the given CloudEvent.

func WithExtensions

func WithExtensions(extensions map[string]interface{}) Option

WithExtensions returns an option that changes the extensions for the given CloudEvent.

func WithID

func WithID(id string) Option

WithType returns an option that changes the id for the given CloudEvent.

func WithSource

func WithSource(eventSource string) Option

WithSource returns an option that changes the source for the given CloudEvent.

func WithType

func WithType(eventType string) Option

WithType returns an option that changes the type for the given CloudEvent.

Jump to

Keyboard shortcuts

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