event

package
v2.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 17 Imported by: 401

Documentation

Overview

Package event provides primitives to work with CloudEvents specification: https://github.com/cloudevents/spec.

Index

Constants

View Source
const (
	TextPlain                       = "text/plain"
	TextJSON                        = "text/json"
	ApplicationJSON                 = "application/json"
	ApplicationXML                  = "application/xml"
	ApplicationCloudEventsJSON      = "application/cloudevents+json"
	ApplicationCloudEventsBatchJSON = "application/cloudevents-batch+json"
)
View Source
const (
	Base64 = "base64"
)
View Source
const (
	// CloudEventsVersionV03 represents the version 0.3 of the CloudEvents spec.
	CloudEventsVersionV03 = "0.3"
)
View Source
const (
	// CloudEventsVersionV1 represents the version 1.0 of the CloudEvents spec.
	CloudEventsVersionV1 = "1.0"
)
View Source
const (
	// DataContentEncodingKey is the key to DeprecatedDataContentEncoding for versions that do not support data content encoding
	// directly.
	DataContentEncodingKey = "datacontentencoding"
)

Variables

View Source
var (
	// This determines the behavior of validateExtensionName(). For MaxExtensionNameLength > 0, an error will be returned,
	// if len(key) > MaxExtensionNameLength
	MaxExtensionNameLength = 0
)

Functions

func IsExtensionNameValid added in v2.4.0

func IsExtensionNameValid(key string) bool

func ReadJson added in v2.4.0

func ReadJson(out *Event, reader io.Reader) error

func StringOfApplicationCloudEventsBatchJSON

func StringOfApplicationCloudEventsBatchJSON() *string

StringOfApplicationCloudEventsBatchJSON returns a string pointer to "application/cloudevents-batch+json"

func StringOfApplicationCloudEventsJSON

func StringOfApplicationCloudEventsJSON() *string

StringOfApplicationCloudEventsJSON returns a string pointer to "application/cloudevents+json"

func StringOfApplicationJSON

func StringOfApplicationJSON() *string

StringOfApplicationJSON returns a string pointer to "application/json"

func StringOfApplicationXML

func StringOfApplicationXML() *string

StringOfApplicationXML returns a string pointer to "application/xml"

func StringOfBase64

func StringOfBase64() *string

StringOfBase64 returns a string pointer to "Base64"

func StringOfTextPlain

func StringOfTextPlain() *string

StringOfTextPlain returns a string pointer to "text/plain"

func WriteJson added in v2.4.0

func WriteJson(in *Event, writer io.Writer) error

WriteJson writes the in event in the provided writer. Note: this function assumes the input event is valid.

Types

type Event

type Event struct {
	Context     EventContext
	DataEncoded []byte
	// DataBase64 indicates if the event, when serialized, represents
	// the data field using the base64 encoding.
	// In v0.3, this field is superseded by DataContentEncoding
	DataBase64  bool
	FieldErrors map[string]error
}

Event represents the canonical representation of a CloudEvent.

func New

func New(version ...string) Event

New returns a new Event, an optional version can be passed to change the default spec version from 1.0 to the provided version.

func (Event) Clone

func (e Event) Clone() Event

func (Event) Data

func (e Event) Data() []byte

func (Event) DataAs

func (e Event) DataAs(obj interface{}) error

DataAs attempts to populate the provided data object with the event payload. obj should be a pointer type.

func (Event) DataContentType

func (e Event) DataContentType() string

DataContentType implements EventReader.DataContentType

func (Event) DataMediaType

func (e Event) DataMediaType() string

DataMediaType returns the parsed DataMediaType of the event. If parsing fails, the empty string is returned. To retrieve the parsing error, use `Context.GetDataMediaType` instead.

func (Event) DataSchema

func (e Event) DataSchema() string

DataSchema implements EventReader.DataSchema

func (Event) DeprecatedDataContentEncoding

func (e Event) DeprecatedDataContentEncoding() string

DeprecatedDataContentEncoding implements EventReader.DeprecatedDataContentEncoding

func (Event) ExtensionAs

func (e Event) ExtensionAs(name string, obj interface{}) error

ExtensionAs is deprecated: access extensions directly via the e.Extensions() map. Use functions in the types package to convert extension values. For example replace this:

var i int
err := e.ExtensionAs("foo", &i)

With this:

i, err := types.ToInteger(e.Extensions["foo"])

func (Event) Extensions

func (e Event) Extensions() map[string]interface{}

Extensions implements EventReader.Extensions

func (Event) ID

func (e Event) ID() string

ID implements EventReader.ID

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom json marshal method used when this type is marshaled using json.Marshal.

func (*Event) SetData

func (e *Event) SetData(contentType string, obj interface{}) error

SetData encodes the given payload with the given content type. If the provided payload is a byte array, when marshalled to json it will be encoded as base64. If the provided payload is different from byte array, datacodec.Encode is invoked to attempt a marshalling to byte array.

func (*Event) SetDataContentEncoding

func (e *Event) SetDataContentEncoding(enc string)

SetDataContentEncoding is deprecated. Implements EventWriter.SetDataContentEncoding.

func (*Event) SetDataContentType

func (e *Event) SetDataContentType(ct string)

SetDataContentType implements EventWriter.SetDataContentType

func (*Event) SetDataSchema

func (e *Event) SetDataSchema(s string)

SetDataSchema implements EventWriter.SetDataSchema

func (*Event) SetExtension

func (e *Event) SetExtension(name string, obj interface{})

SetExtension implements EventWriter.SetExtension

func (*Event) SetID

func (e *Event) SetID(id string)

SetID implements EventWriter.SetID

func (*Event) SetSource

func (e *Event) SetSource(s string)

SetSource implements EventWriter.SetSource

func (*Event) SetSpecVersion

func (e *Event) SetSpecVersion(v string)

SetSpecVersion implements EventWriter.SetSpecVersion

func (*Event) SetSubject

func (e *Event) SetSubject(s string)

SetSubject implements EventWriter.SetSubject

func (*Event) SetTime

func (e *Event) SetTime(t time.Time)

SetTime implements EventWriter.SetTime

func (*Event) SetType

func (e *Event) SetType(t string)

SetType implements EventWriter.SetType

func (Event) Source

func (e Event) Source() string

Source implements EventReader.Source

func (Event) SpecVersion

func (e Event) SpecVersion() string

SpecVersion implements EventReader.SpecVersion

func (Event) String

func (e Event) String() string

String returns a pretty-printed representation of the Event.

func (Event) Subject

func (e Event) Subject() string

Subject implements EventReader.Subject

func (Event) Time

func (e Event) Time() time.Time

Time implements EventReader.Time

func (Event) Type

func (e Event) Type() string

Type implements EventReader.Type

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json unmarshal method used when this type is unmarshaled using json.Unmarshal.

func (Event) Validate

func (e Event) Validate() error

Validate performs a spec based validation on this event. Validation is dependent on the spec version specified in the event context.

type EventContext

type EventContext interface {
	// EventContextConverter allows for conversion between versions.
	EventContextConverter

	// EventContextReader adds methods for reading context.
	EventContextReader

	// EventContextWriter adds methods for writing to context.
	EventContextWriter

	// Validate the event based on the specifics of the CloudEvents spec version
	// represented by this event context.
	Validate() ValidationError

	// Clone clones the event context.
	Clone() EventContext

	// String returns a pretty-printed representation of the EventContext.
	String() string
}

EventContext is conical interface for a CloudEvents Context.

type EventContextConverter

type EventContextConverter interface {
	// AsV03 provides a translation from whatever the "native" encoding of the
	// CloudEvent was to the equivalent in v0.3 field names, moving fields to or
	// from extensions as necessary.
	AsV03() *EventContextV03

	// AsV1 provides a translation from whatever the "native" encoding of the
	// CloudEvent was to the equivalent in v1.0 field names, moving fields to or
	// from extensions as necessary.
	AsV1() *EventContextV1
}

EventContextConverter are the methods that allow for event version conversion.

type EventContextReader

type EventContextReader interface {
	// GetSpecVersion returns the native CloudEvents Spec version of the event
	// context.
	GetSpecVersion() string
	// GetType returns the CloudEvents type from the context.
	GetType() string
	// GetSource returns the CloudEvents source from the context.
	GetSource() string
	// GetSubject returns the CloudEvents subject from the context.
	GetSubject() string
	// GetID returns the CloudEvents ID from the context.
	GetID() string
	// GetTime returns the CloudEvents creation time from the context.
	GetTime() time.Time
	// GetDataSchema returns the CloudEvents schema URL (if any) from the
	// context.
	GetDataSchema() string
	// GetDataContentType returns content type on the context.
	GetDataContentType() string
	// DeprecatedGetDataContentEncoding returns content encoding on the context.
	DeprecatedGetDataContentEncoding() string

	// GetDataMediaType returns the MIME media type for encoded data, which is
	// needed by both encoding and decoding. This is a processed form of
	// GetDataContentType and it may return an error.
	GetDataMediaType() (string, error)

	// DEPRECATED: Access extensions directly via the GetExtensions()
	// For example replace this:
	//
	//     var i int
	//     err := ec.ExtensionAs("foo", &i)
	//
	// With this:
	//
	//     i, err := types.ToInteger(ec.GetExtensions["foo"])
	//
	ExtensionAs(string, interface{}) error

	// GetExtensions returns the full extensions map.
	//
	// Extensions use the CloudEvents type system, details in package cloudevents/types.
	GetExtensions() map[string]interface{}

	// GetExtension returns the extension associated with with the given key.
	// The given key is case insensitive. If the extension can not be found,
	// an error will be returned.
	GetExtension(string) (interface{}, error)
}

EventContextReader are the methods required to be a reader of context attributes.

type EventContextV03

type EventContextV03 struct {
	// Type - The type of the occurrence which has happened.
	Type string `json:"type"`
	// Source - A URI describing the event producer.
	Source types.URIRef `json:"source"`
	// Subject - The subject of the event in the context of the event producer
	// (identified by `source`).
	Subject *string `json:"subject,omitempty"`
	// ID of the event; must be non-empty and unique within the scope of the producer.
	ID string `json:"id"`
	// Time - A Timestamp when the event happened.
	Time *types.Timestamp `json:"time,omitempty"`
	// DataSchema - A link to the schema that the `data` attribute adheres to.
	SchemaURL *types.URIRef `json:"schemaurl,omitempty"`
	// GetDataMediaType - A MIME (RFC2046) string describing the media type of `data`.
	DataContentType *string `json:"datacontenttype,omitempty"`
	// DeprecatedDataContentEncoding describes the content encoding for the `data` attribute. Valid: nil, `Base64`.
	DataContentEncoding *string `json:"datacontentencoding,omitempty"`
	// Extensions - Additional extension metadata beyond the base spec.
	Extensions map[string]interface{} `json:"-"`
}

EventContextV03 represents the non-data attributes of a CloudEvents v0.3 event.

func (EventContextV03) AsV03

func (ec EventContextV03) AsV03() *EventContextV03

AsV03 implements EventContextConverter.AsV03

func (EventContextV03) AsV1

func (ec EventContextV03) AsV1() *EventContextV1

AsV1 implements EventContextConverter.AsV1

func (EventContextV03) Clone

func (ec EventContextV03) Clone() EventContext

Clone implements EventContextConverter.Clone

func (EventContextV03) DeprecatedGetDataContentEncoding

func (ec EventContextV03) DeprecatedGetDataContentEncoding() string

DeprecatedGetDataContentEncoding implements EventContextReader.DeprecatedGetDataContentEncoding

func (*EventContextV03) DeprecatedSetDataContentEncoding

func (ec *EventContextV03) DeprecatedSetDataContentEncoding(e string) error

DeprecatedSetDataContentEncoding implements EventContextWriter.DeprecatedSetDataContentEncoding

func (EventContextV03) ExtensionAs

func (ec EventContextV03) ExtensionAs(name string, obj interface{}) error

ExtensionAs implements EventContext.ExtensionAs

func (EventContextV03) GetDataContentType

func (ec EventContextV03) GetDataContentType() string

GetDataContentType implements EventContextReader.GetDataContentType

func (EventContextV03) GetDataMediaType

func (ec EventContextV03) GetDataMediaType() (string, error)

GetDataMediaType implements EventContextReader.GetDataMediaType

func (EventContextV03) GetDataSchema

func (ec EventContextV03) GetDataSchema() string

GetDataSchema implements EventContextReader.GetDataSchema

func (EventContextV03) GetExtension

func (ec EventContextV03) GetExtension(key string) (interface{}, error)

GetExtension implements EventContextReader.GetExtension

func (EventContextV03) GetExtensions

func (ec EventContextV03) GetExtensions() map[string]interface{}

GetExtensions implements EventContextReader.GetExtensions

func (EventContextV03) GetID

func (ec EventContextV03) GetID() string

GetID implements EventContextReader.GetID

func (EventContextV03) GetSource

func (ec EventContextV03) GetSource() string

GetSource implements EventContextReader.GetSource

func (EventContextV03) GetSpecVersion

func (ec EventContextV03) GetSpecVersion() string

GetSpecVersion implements EventContextReader.GetSpecVersion

func (EventContextV03) GetSubject

func (ec EventContextV03) GetSubject() string

GetSubject implements EventContextReader.GetSubject

func (EventContextV03) GetTime

func (ec EventContextV03) GetTime() time.Time

GetTime implements EventContextReader.GetTime

func (EventContextV03) GetType

func (ec EventContextV03) GetType() string

GetType implements EventContextReader.GetType

func (*EventContextV03) SetDataContentType

func (ec *EventContextV03) SetDataContentType(ct string) error

SetDataContentType implements EventContextWriter.SetDataContentType

func (*EventContextV03) SetDataSchema

func (ec *EventContextV03) SetDataSchema(u string) error

SetDataSchema implements EventContextWriter.SetDataSchema

func (*EventContextV03) SetExtension

func (ec *EventContextV03) SetExtension(name string, value interface{}) error

SetExtension adds the extension 'name' with value 'value' to the CloudEvents context. This function fails if the name uses a reserved event context key.

func (*EventContextV03) SetID

func (ec *EventContextV03) SetID(id string) error

SetID implements EventContextWriter.SetID

func (*EventContextV03) SetSource

func (ec *EventContextV03) SetSource(u string) error

SetSource implements EventContextWriter.SetSource

func (*EventContextV03) SetSubject

func (ec *EventContextV03) SetSubject(s string) error

SetSubject implements EventContextWriter.SetSubject

func (*EventContextV03) SetTime

func (ec *EventContextV03) SetTime(t time.Time) error

SetTime implements EventContextWriter.SetTime

func (*EventContextV03) SetType

func (ec *EventContextV03) SetType(t string) error

SetType implements EventContextWriter.SetType

func (EventContextV03) String

func (ec EventContextV03) String() string

String returns a pretty-printed representation of the EventContext.

func (EventContextV03) Validate

func (ec EventContextV03) Validate() ValidationError

Validate returns errors based on requirements from the CloudEvents spec. For more details, see https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md As of Feb 26, 2019, commit 17c32ea26baf7714ad027d9917d03d2fff79fc7e + https://github.com/cloudevents/spec/pull/387 -> datacontentencoding + https://github.com/cloudevents/spec/pull/406 -> subject

type EventContextV1

type EventContextV1 struct {
	// ID of the event; must be non-empty and unique within the scope of the producer.
	// +required
	ID string `json:"id"`
	// Source - A URI describing the event producer.
	// +required
	Source types.URIRef `json:"source"`
	// Type - The type of the occurrence which has happened.
	// +required
	Type string `json:"type"`

	// DataContentType - A MIME (RFC2046) string describing the media type of `data`.
	// +optional
	DataContentType *string `json:"datacontenttype,omitempty"`
	// Subject - The subject of the event in the context of the event producer
	// (identified by `source`).
	// +optional
	Subject *string `json:"subject,omitempty"`
	// Time - A Timestamp when the event happened.
	// +optional
	Time *types.Timestamp `json:"time,omitempty"`
	// DataSchema - A link to the schema that the `data` attribute adheres to.
	// +optional
	DataSchema *types.URI `json:"dataschema,omitempty"`

	// Extensions - Additional extension metadata beyond the base spec.
	// +optional
	Extensions map[string]interface{} `json:"-"`
}

EventContextV1 represents the non-data attributes of a CloudEvents v1.0 event.

func (EventContextV1) AsV03

func (ec EventContextV1) AsV03() *EventContextV03

AsV03 implements EventContextConverter.AsV03

func (EventContextV1) AsV1

func (ec EventContextV1) AsV1() *EventContextV1

AsV1 implements EventContextConverter.AsV1

func (EventContextV1) Clone

func (ec EventContextV1) Clone() EventContext

Clone implements EventContextConverter.Clone

func (EventContextV1) DeprecatedGetDataContentEncoding

func (ec EventContextV1) DeprecatedGetDataContentEncoding() string

DeprecatedGetDataContentEncoding implements EventContextReader.DeprecatedGetDataContentEncoding

func (*EventContextV1) DeprecatedSetDataContentEncoding

func (ec *EventContextV1) DeprecatedSetDataContentEncoding(e string) error

DeprecatedSetDataContentEncoding implements EventContextWriter.DeprecatedSetDataContentEncoding

func (EventContextV1) ExtensionAs

func (ec EventContextV1) ExtensionAs(name string, obj interface{}) error

ExtensionAs implements EventContext.ExtensionAs

func (EventContextV1) GetDataContentType

func (ec EventContextV1) GetDataContentType() string

GetDataContentType implements EventContextReader.GetDataContentType

func (EventContextV1) GetDataMediaType

func (ec EventContextV1) GetDataMediaType() (string, error)

GetDataMediaType implements EventContextReader.GetDataMediaType

func (EventContextV1) GetDataSchema

func (ec EventContextV1) GetDataSchema() string

GetDataSchema implements EventContextReader.GetDataSchema

func (EventContextV1) GetExtension

func (ec EventContextV1) GetExtension(key string) (interface{}, error)

GetExtension implements EventContextReader.GetExtension

func (EventContextV1) GetExtensions

func (ec EventContextV1) GetExtensions() map[string]interface{}

GetExtensions implements EventContextReader.GetExtensions

func (EventContextV1) GetID

func (ec EventContextV1) GetID() string

GetID implements EventContextReader.GetID

func (EventContextV1) GetSource

func (ec EventContextV1) GetSource() string

GetSource implements EventContextReader.GetSource

func (EventContextV1) GetSpecVersion

func (ec EventContextV1) GetSpecVersion() string

GetSpecVersion implements EventContextReader.GetSpecVersion

func (EventContextV1) GetSubject

func (ec EventContextV1) GetSubject() string

GetSubject implements EventContextReader.GetSubject

func (EventContextV1) GetTime

func (ec EventContextV1) GetTime() time.Time

GetTime implements EventContextReader.GetTime

func (EventContextV1) GetType

func (ec EventContextV1) GetType() string

GetType implements EventContextReader.GetType

func (*EventContextV1) SetDataContentType

func (ec *EventContextV1) SetDataContentType(ct string) error

SetDataContentType implements EventContextWriter.SetDataContentType

func (*EventContextV1) SetDataSchema

func (ec *EventContextV1) SetDataSchema(u string) error

SetDataSchema implements EventContextWriter.SetDataSchema

func (*EventContextV1) SetExtension

func (ec *EventContextV1) SetExtension(name string, value interface{}) error

SetExtension adds the extension 'name' with value 'value' to the CloudEvents context. This function fails if the name doesn't respect the regex ^[a-zA-Z0-9]+$ or if the name uses a reserved event context key.

func (*EventContextV1) SetID

func (ec *EventContextV1) SetID(id string) error

SetID implements EventContextWriter.SetID

func (*EventContextV1) SetSource

func (ec *EventContextV1) SetSource(u string) error

SetSource implements EventContextWriter.SetSource

func (*EventContextV1) SetSubject

func (ec *EventContextV1) SetSubject(s string) error

SetSubject implements EventContextWriter.SetSubject

func (*EventContextV1) SetTime

func (ec *EventContextV1) SetTime(t time.Time) error

SetTime implements EventContextWriter.SetTime

func (*EventContextV1) SetType

func (ec *EventContextV1) SetType(t string) error

SetType implements EventContextWriter.SetType

func (EventContextV1) String

func (ec EventContextV1) String() string

String returns a pretty-printed representation of the EventContext.

func (EventContextV1) Validate

func (ec EventContextV1) Validate() ValidationError

Validate returns errors based on requirements from the CloudEvents spec. For more details, see https://github.com/cloudevents/spec/blob/v1.0/spec.md.

type EventContextWriter

type EventContextWriter interface {
	// SetType sets the type of the context.
	SetType(string) error
	// SetSource sets the source of the context.
	SetSource(string) error
	// SetSubject sets the subject of the context.
	SetSubject(string) error
	// SetID sets the ID of the context.
	SetID(string) error
	// SetTime sets the time of the context.
	SetTime(time time.Time) error
	// SetDataSchema sets the schema url of the context.
	SetDataSchema(string) error
	// SetDataContentType sets the data content type of the context.
	SetDataContentType(string) error
	// DeprecatedSetDataContentEncoding sets the data context encoding of the context.
	DeprecatedSetDataContentEncoding(string) error

	// SetExtension sets the given interface onto the extension attributes
	// determined by the provided name.
	//
	// This function fails in V1 if the name doesn't respect the regex ^[a-zA-Z0-9]+$
	//
	// Package ./types documents the types that are allowed as extension values.
	SetExtension(string, interface{}) error
}

EventContextWriter are the methods required to be a writer of context attributes.

type EventReader

type EventReader interface {
	// SpecVersion returns event.Context.GetSpecVersion().
	SpecVersion() string
	// Type returns event.Context.GetType().
	Type() string
	// Source returns event.Context.GetSource().
	Source() string
	// Subject returns event.Context.GetSubject().
	Subject() string
	// ID returns event.Context.GetID().
	ID() string
	// Time returns event.Context.GetTime().
	Time() time.Time
	// DataSchema returns event.Context.GetDataSchema().
	DataSchema() string
	// DataContentType returns event.Context.GetDataContentType().
	DataContentType() string
	// DataMediaType returns event.Context.GetDataMediaType().
	DataMediaType() string
	// DeprecatedDataContentEncoding returns event.Context.DeprecatedGetDataContentEncoding().
	DeprecatedDataContentEncoding() string

	// Extensions returns the event.Context.GetExtensions().
	// Extensions use the CloudEvents type system, details in package cloudevents/types.
	Extensions() map[string]interface{}

	// ExtensionAs returns event.Context.ExtensionAs(name, obj).
	//
	// DEPRECATED: Access extensions directly via the e.Extensions() map.
	// Use functions in the types package to convert extension values.
	// For example replace this:
	//
	//     var i int
	//     err := e.ExtensionAs("foo", &i)
	//
	// With this:
	//
	//     i, err := types.ToInteger(e.Extensions["foo"])
	//
	ExtensionAs(string, interface{}) error

	// Data returns the raw data buffer
	// If the event was encoded with base64 encoding, Data returns the already decoded
	// byte array
	Data() []byte

	// DataAs attempts to populate the provided data object with the event payload.
	DataAs(interface{}) error
}

EventReader is the interface for reading through an event from attributes.

type EventWriter

type EventWriter interface {

	// SetSpecVersion performs event.Context.SetSpecVersion.
	SetSpecVersion(string)
	// SetType performs event.Context.SetType.
	SetType(string)
	// SetSource performs event.Context.SetSource.
	SetSource(string)
	// SetSubject( performs event.Context.SetSubject.
	SetSubject(string)
	// SetID performs event.Context.SetID.
	SetID(string)
	// SetTime performs event.Context.SetTime.
	SetTime(time.Time)
	// SetDataSchema performs event.Context.SetDataSchema.
	SetDataSchema(string)
	// SetDataContentType performs event.Context.SetDataContentType.
	SetDataContentType(string)
	// DeprecatedSetDataContentEncoding performs event.Context.DeprecatedSetDataContentEncoding.
	SetDataContentEncoding(string)

	// SetExtension performs event.Context.SetExtension.
	SetExtension(string, interface{})

	// SetData encodes the given payload with the given content type.
	// If the provided payload is a byte array, when marshalled to json it will be encoded as base64.
	// If the provided payload is different from byte array, datacodec.Encode is invoked to attempt a
	// marshalling to byte array.
	SetData(string, interface{}) error
}

EventWriter is the interface for writing through an event onto attributes. If an error is thrown by a sub-component, EventWriter caches the error internally and exposes errors with a call to event.Validate().

type ValidationError

type ValidationError map[string]error

func (ValidationError) Error

func (e ValidationError) Error() string

Directories

Path Synopsis
Package datacodec holds the data codec registry and adds known encoders and decoders supporting media types such as `application/json` and `application/xml`.
Package datacodec holds the data codec registry and adds known encoders and decoders supporting media types such as `application/json` and `application/xml`.
json
Package json holds the encoder/decoder implementation for `application/json`.
Package json holds the encoder/decoder implementation for `application/json`.
text
Package text holds the encoder/decoder implementation for `text/plain`.
Package text holds the encoder/decoder implementation for `text/plain`.
xml
Package xml holds the encoder/decoder implementation for `application/xml`.
Package xml holds the encoder/decoder implementation for `application/xml`.

Jump to

Keyboard shortcuts

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