Versions in this module Expand all Collapse all v2 v2.0.2 Apr 16, 2020 v2.0.1 Apr 16, 2020 Changes in this version + const ApplicationCloudEventsBatchJSON + const ApplicationCloudEventsJSON + const ApplicationJSON + const ApplicationXML + const Base64 + const CloudEventsVersionV03 + const CloudEventsVersionV1 + const DataContentEncodingKey + const EventTypeVersionKey + const SubjectKey + const TextJSON + const TextPlain + var EventMarshalLatencyMs = stats.Float64("cloudevents.io/sdk-go/event/json/latency", ...) + var EventMarshalLatencyView = &view.View + var IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString + func JsonEncode(e Event) ([]byte, error) + func JsonEncodeLegacy(e Event) ([]byte, error) + func StringOfApplicationCloudEventsBatchJSON() *string + func StringOfApplicationCloudEventsJSON() *string + func StringOfApplicationJSON() *string + func StringOfApplicationXML() *string + func StringOfBase64() *string + func StringOfTextPlain() *string + type Event struct + Context EventContext + DataBinary bool + DataEncoded []byte + FieldErrors map[string]error + func New(version ...string) Event + func (e *Event) JsonDecodeV03(body []byte, raw map[string]json.RawMessage) error + func (e *Event) JsonDecodeV1(body []byte, raw map[string]json.RawMessage) error + func (e *Event) SetData(contentType string, obj interface{}) error + func (e *Event) SetDataContentEncoding(enc string) + func (e *Event) SetDataContentType(ct string) + func (e *Event) SetDataSchema(s string) + func (e *Event) SetExtension(name string, obj interface{}) + func (e *Event) SetID(id string) + func (e *Event) SetSource(s string) + func (e *Event) SetSpecVersion(v string) + func (e *Event) SetSubject(s string) + func (e *Event) SetTime(t time.Time) + func (e *Event) SetType(t string) + func (e *Event) UnmarshalJSON(b []byte) error + func (e Event) Clone() Event + func (e Event) Data() []byte + func (e Event) DataAs(obj interface{}) error + func (e Event) DataContentType() string + func (e Event) DataMediaType() string + func (e Event) DataSchema() string + func (e Event) DeprecatedDataContentEncoding() string + func (e Event) ExtensionAs(name string, obj interface{}) error + func (e Event) Extensions() map[string]interface{} + func (e Event) ID() string + func (e Event) MarshalJSON() ([]byte, error) + func (e Event) Source() string + func (e Event) SpecVersion() string + func (e Event) String() string + func (e Event) Subject() string + func (e Event) Time() time.Time + func (e Event) Type() string + func (e Event) Validate() error + type EventContext interface + Clone func() EventContext + String func() string + Validate func() error + type EventContextConverter interface + AsV03 func() *EventContextV03 + AsV1 func() *EventContextV1 + type EventContextReader interface + DeprecatedGetDataContentEncoding func() string + ExtensionAs func(string, interface{}) error + GetDataContentType func() string + GetDataMediaType func() (string, error) + GetDataSchema func() string + GetExtension func(string) (interface{}, error) + GetExtensions func() map[string]interface{} + GetID func() string + GetSource func() string + GetSpecVersion func() string + GetSubject func() string + GetTime func() time.Time + GetType func() string + type EventContextV03 struct + DataContentEncoding *string + DataContentType *string + Extensions map[string]interface{} + ID string + SchemaURL *types.URIRef + Source types.URIRef + SpecVersion string + Subject *string + Time *types.Timestamp + Type string + func (ec *EventContextV03) DeprecatedSetDataContentEncoding(e string) error + func (ec *EventContextV03) SetDataContentType(ct string) error + func (ec *EventContextV03) SetDataSchema(u string) error + func (ec *EventContextV03) SetExtension(name string, value interface{}) error + func (ec *EventContextV03) SetID(id string) error + func (ec *EventContextV03) SetSource(u string) error + func (ec *EventContextV03) SetSpecVersion(v string) error + func (ec *EventContextV03) SetSubject(s string) error + func (ec *EventContextV03) SetTime(t time.Time) error + func (ec *EventContextV03) SetType(t string) error + func (ec EventContextV03) AsV03() *EventContextV03 + func (ec EventContextV03) AsV1() *EventContextV1 + func (ec EventContextV03) Clone() EventContext + func (ec EventContextV03) DeprecatedGetDataContentEncoding() string + func (ec EventContextV03) ExtensionAs(name string, obj interface{}) error + func (ec EventContextV03) GetDataContentType() string + func (ec EventContextV03) GetDataMediaType() (string, error) + func (ec EventContextV03) GetDataSchema() string + func (ec EventContextV03) GetExtension(key string) (interface{}, error) + func (ec EventContextV03) GetExtensions() map[string]interface{} + func (ec EventContextV03) GetID() string + func (ec EventContextV03) GetSource() string + func (ec EventContextV03) GetSpecVersion() string + func (ec EventContextV03) GetSubject() string + func (ec EventContextV03) GetTime() time.Time + func (ec EventContextV03) GetType() string + func (ec EventContextV03) String() string + func (ec EventContextV03) Validate() error + type EventContextV1 struct + DataContentType *string + DataSchema *types.URI + Extensions map[string]interface{} + ID string + Source types.URIRef + SpecVersion string + Subject *string + Time *types.Timestamp + Type string + func (ec *EventContextV1) DeprecatedSetDataContentEncoding(e string) error + func (ec *EventContextV1) SetDataContentType(ct string) error + func (ec *EventContextV1) SetDataSchema(u string) error + func (ec *EventContextV1) SetExtension(name string, value interface{}) error + func (ec *EventContextV1) SetID(id string) error + func (ec *EventContextV1) SetSource(u string) error + func (ec *EventContextV1) SetSpecVersion(v string) error + func (ec *EventContextV1) SetSubject(s string) error + func (ec *EventContextV1) SetTime(t time.Time) error + func (ec *EventContextV1) SetType(t string) error + func (ec EventContextV1) AsV03() *EventContextV03 + func (ec EventContextV1) AsV1() *EventContextV1 + func (ec EventContextV1) Clone() EventContext + func (ec EventContextV1) DeprecatedGetDataContentEncoding() string + func (ec EventContextV1) ExtensionAs(name string, obj interface{}) error + func (ec EventContextV1) GetDataContentType() string + func (ec EventContextV1) GetDataMediaType() (string, error) + func (ec EventContextV1) GetDataSchema() string + func (ec EventContextV1) GetExtension(key string) (interface{}, error) + func (ec EventContextV1) GetExtensions() map[string]interface{} + func (ec EventContextV1) GetID() string + func (ec EventContextV1) GetSource() string + func (ec EventContextV1) GetSpecVersion() string + func (ec EventContextV1) GetSubject() string + func (ec EventContextV1) GetTime() time.Time + func (ec EventContextV1) GetType() string + func (ec EventContextV1) String() string + func (ec EventContextV1) Validate() error + type EventContextWriter interface + DeprecatedSetDataContentEncoding func(string) error + SetDataContentType func(string) error + SetDataSchema func(string) error + SetExtension func(string, interface{}) error + SetID func(string) error + SetSource func(string) error + SetSpecVersion func(string) error + SetSubject func(string) error + SetTime func(time time.Time) error + SetType func(string) error + type EventReader interface + Data func() []byte + DataAs func(interface{}) error + DataContentType func() string + DataMediaType func() string + DataSchema func() string + DeprecatedDataContentEncoding func() string + ExtensionAs func(string, interface{}) error + Extensions func() map[string]interface{} + ID func() string + Source func() string + SpecVersion func() string + Subject func() string + Time func() time.Time + Type func() string + type EventWriter interface + SetData func(string, interface{}) error + SetDataContentEncoding func(string) + SetDataContentType func(string) + SetDataSchema func(string) + SetExtension func(string, interface{}) + SetID func(string) + SetSource func(string) + SetSpecVersion func(string) + SetSubject func(string) + SetTime func(time.Time) + SetType func(string)