Files
dependabot[bot]andlnx01 3a5c8e8100 🌱 Bump github.com/cloudevents/sdk-go/v2 from 2.14.0 to 2.15.2 (#409)
Bumps [github.com/cloudevents/sdk-go/v2](https://github.com/cloudevents/sdk-go) from 2.14.0 to 2.15.2.
- [Release notes](https://github.com/cloudevents/sdk-go/releases)
- [Commits](https://github.com/cloudevents/sdk-go/compare/v2.14.0...v2.15.2)

---
updated-dependencies:
- dependency-name: github.com/cloudevents/sdk-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-09 02:00:20 +00:00

51 lines
1.5 KiB
Go

/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
package binding
import "errors"
// Encoding enum specifies the type of encodings supported by binding interfaces
type Encoding int
const (
// Binary encoding as specified in https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#message
EncodingBinary Encoding = iota
// Structured encoding as specified in https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#message
EncodingStructured
// Message is an instance of EventMessage or it contains EventMessage nested (through MessageWrapper)
EncodingEvent
// When the encoding is unknown (which means that the message is a non-event)
EncodingUnknown
// EncodingBatch is an instance of JSON Batched Events
EncodingBatch
)
func (e Encoding) String() string {
switch e {
case EncodingBinary:
return "binary"
case EncodingStructured:
return "structured"
case EncodingEvent:
return "event"
case EncodingBatch:
return "batch"
case EncodingUnknown:
return "unknown"
}
return ""
}
// ErrUnknownEncoding specifies that the Message is not an event or it is encoded with an unknown encoding
var ErrUnknownEncoding = errors.New("unknown Message encoding")
// ErrNotStructured returned by Message.Structured for non-structured messages.
var ErrNotStructured = errors.New("message is not in structured mode")
// ErrNotBinary returned by Message.Binary for non-binary messages.
var ErrNotBinary = errors.New("message is not in binary mode")