encoding

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 5 Imported by: 0

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
}

Codec ...

func (*Codec) Decode

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

Decode ...

func (*Codec) Encode

Encode ...

type CodecStructured

type CodecStructured struct {
	Encoding Encoding
}

CodecStructured ...

type CodecV02

type CodecV02 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

CodecV02 ...

func (CodecV02) Decode

Decode ...

func (CodecV02) Encode

Encode ...

type CodecV03

type CodecV03 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

CodecV03 ...

func (CodecV03) Decode

Decode ...

func (CodecV03) Encode

Encode ...

type CodecV1

type CodecV1 struct {
	CodecStructured

	TransportName string
	Encoding      Encoding
}

CodecV1 ...

func (CodecV1) Decode

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

Decode ...

func (CodecV1) Encode

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
}

EventBridgeMessage ...

func DecodeEventBridgeMessage

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

DecodeEventBridgeMessage ...

func (*EventBridgeMessage) GetBody

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

GetBody ...

func (*EventBridgeMessage) IsValid

func (m *EventBridgeMessage) IsValid() bool

IsValid ...

type Message

type Message struct {
	Body []byte
}

Message ...

func (Message) CloudEventsVersion

func (m Message) CloudEventsVersion() string

CloudEventsVersion ...

type SNSMessage

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

SNSMessage ...

func DecodeSNSMessage

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

DecodeSNSMessage ...

func (*SNSMessage) GetBody

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

GetBody ...

func (*SNSMessage) IsNotification

func (m *SNSMessage) IsNotification() bool

IsNotification ...

Jump to

Keyboard shortcuts

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