1234567891011121314151617 |
- package borealis
- type V1MessageCodec[T any] struct{}
- func (encoder *V1MessageCodec[T]) Encode(stream string, message any) ([]byte, error) {
- event := message.(RawEvent[T])
- output, err := event.EncodeCBOR()
- if err != nil {
- return nil, err
- }
- return output, nil
- }
- func (encoder *V1MessageCodec[T]) Decode(stream string, input []byte, messagePtr any) error {
- event := messagePtr.(RawEvent[T])
- return event.DecodeCBOR(input)
- }
|