encoding

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 5 Imported by: ? 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec struct {
	Encoding      Encoding
	TransportName string
	// contains filtered or unexported fields
}

func (*Codec) Decode

func (c *Codec) Decode(ctx context.Context, msg transport.Message) (*cloudevents.Event, error)

func (*Codec) Encode

type CodecStructured

type CodecStructured struct {
	Encoding Encoding
}

CodecStructured represents an structured http transport codec for all versions. Intended to be used as a base class.

type CodecV1

type CodecV1 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

func (CodecV1) Decode

func (v CodecV1) Decode(ctx context.Context, msg transport.Message) (*cloudevents.Event, error)

func (CodecV1) Encode

type CodecV02

type CodecV02 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

func (CodecV02) Decode

func (CodecV02) Encode

type CodecV03

type CodecV03 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

func (CodecV03) Decode

func (CodecV03) Encode

type Encoding

type Encoding int32

Encoding to use for NATS transport.

const (
	// Default allows NATS transport implementation to pick.
	Default Encoding = iota
	// StructuredV02 is Structured CloudEvents spec v0.2.
	StructuredV02
	// StructuredV03 is Structured CloudEvents spec v0.3.
	StructuredV03
	// StructuredV1 is Structured CloudEvents spec v1.0.
	StructuredV1
	// Unknown is unknown.
	Unknown
)

func (Encoding) String

func (e Encoding) String() string

String pretty-prints the encoding as a string.

func (Encoding) Version

func (e Encoding) Version() string

Version pretty-prints the encoding version as a string.

type EventBridgeMessage

type EventBridgeMessage struct {
	DetailType string      `json:"detail-type"` // In case of EventBridge, this value is nonempty string
	Detail     interface{} `json:"detail"`      // Message object
}

func DecodeEventBridgeMessage

func DecodeEventBridgeMessage(body []byte) (message *EventBridgeMessage, ok bool)

func (*EventBridgeMessage) GetBody

func (m *EventBridgeMessage) GetBody() []byte

func (*EventBridgeMessage) IsValid

func (m *EventBridgeMessage) IsValid() bool

type Message

type Message struct {
	Body []byte
}

func (Message) CloudEventsVersion

func (m Message) CloudEventsVersion() string

type SNSMessage

type SNSMessage struct {
	Type    string // In case of SNS, the type is "Notification"
	Message string // JSON encoded message
}

func DecodeSNSMessage

func DecodeSNSMessage(body []byte) (message *SNSMessage, ok bool)

func (*SNSMessage) GetBody

func (m *SNSMessage) GetBody() []byte

func (*SNSMessage) IsNotification

func (m *SNSMessage) IsNotification() bool

Jump to

Keyboard shortcuts

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