Documentation
¶
Index ¶
- Variables
- func MarshalEvent(event protosource.Event) ([]byte, error)
- func UnmarshalEvent(data []byte) (protosource.Event, error)
- type Serializer
- func (s *Serializer) MarshalEvent(event protosource.Event) (*recordv1.Record, error)
- func (s *Serializer) MarshalEventAsData(event protosource.Event) ([]byte, error)
- func (s *Serializer) UnmarshalEvent(record *recordv1.Record) (protosource.Event, error)
- func (s *Serializer) UnmarshalEventFromData(data []byte) (protosource.Event, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewSerializer, wire.Bind(new(protosource.Serializer), new(*Serializer)), )
ProviderSet provides a protojsonserializer and binds it to protosource.Serializer.
Functions ¶
func MarshalEvent ¶
func MarshalEvent(event protosource.Event) ([]byte, error)
MarshalEvent wraps the event in an anypb.Any and serializes to JSON. The resulting bytes are human-readable JSON containing the fully-qualified type URL and the event fields.
func UnmarshalEvent ¶
func UnmarshalEvent(data []byte) (protosource.Event, error)
UnmarshalEvent deserializes JSON bytes back into an Event. The JSON must contain an anypb.Any envelope with a @type field identifying the concrete event type.
Types ¶
type Serializer ¶
type Serializer struct{}
func NewSerializer ¶
func NewSerializer() *Serializer
func (*Serializer) MarshalEvent ¶
func (s *Serializer) MarshalEvent(event protosource.Event) (*recordv1.Record, error)
func (*Serializer) MarshalEventAsData ¶
func (s *Serializer) MarshalEventAsData(event protosource.Event) ([]byte, error)
func (*Serializer) UnmarshalEvent ¶
func (s *Serializer) UnmarshalEvent(record *recordv1.Record) (protosource.Event, error)
func (*Serializer) UnmarshalEventFromData ¶
func (s *Serializer) UnmarshalEventFromData(data []byte) (protosource.Event, error)
Click to show internal directories.
Click to hide internal directories.