Release 0.6.0, Subject, DataContentEncoding and Setters/Access for Event attributes.
Pre-release
Pre-release
- Switched to Zap logging.
- Added Subject.
- Added DataEncodingType
- Added to level alias. Import
github.com/cloudevents/sdk-go
to get 80% of sdk. - Added Setter/Access style methods on Event object level to aid in event creation an inspection of attributes without context version awareness.
Go style event creation still works, but now this is an option:
event := cloudevents.NewEvent()
event.SetID("ABC-123")
event.SetType("com.cloudevents.readme.sent")
event.SetSource("http://localhost:8080/")
event.SetData(data)
Note that event will default to version 0.2
, the latest released CloudEvents
spec version at this time.
With the top level alias, this is possible:
t, err := cloudevents.NewHTTPTransport(
cloudevents.WithTarget("http://localhost:8080/"),
cloudevents.WithEncoding(cloudevents.HTTPBinaryV02),
)
// handle error
c, err := cloudevents.NewClient(t)
// handle error
c.Send(ctx, event);
Note that the previously named method httptransport.New
is changed to cloudevents.NewHTTPTransport
the alias.go file is a good place to see
the api at a glance.