Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anonymizer ¶
type Anonymizer[T any] struct { // contains filtered or unexported fields }
Anonymizer is a wrapper to any transport.Mapper instance. Anonymizer will anonymize transport model properties using provided StructAnonymizer implementation.
func NewAnonymizer ¶
func NewAnonymizer[T any]( mapper Mapper[T], anonymizer StructAnonymizer, ) *Anonymizer[T]
NewAnonymizer returns a new instance of Anonymizer.
func (*Anonymizer[T]) FromTransport ¶
func (*Anonymizer[T]) ToTransport ¶
type DefaultMapper ¶
type DefaultMapper[T any] struct { // contains filtered or unexported fields }
DefaultMapper implements an interface of transport.Mapper The mapper keeps a list of registered transport.Event defining mapping between stream- and transport- layer models.
func NewDefaultMapper ¶
func NewDefaultMapper[T any]( supportedEvents []Event[T], ) DefaultMapper[T]
NewDefaultMapper returns a new instance of a DefaultMapper.
func (DefaultMapper[T]) FromTransport ¶
func (DefaultMapper[T]) ToTransport ¶
type Event ¶
type Event[T any] interface { StreamEventName() string FromStreamEvent(event esja.Event[T]) ToStreamEvent() esja.Event[T] }
Event is a transport model which defines which stream model it corresponds to and implements the mapping from- and to- the stream model.
type GOBMarshaler ¶
type GOBMarshaler struct{}
func (GOBMarshaler) Marshal ¶
func (GOBMarshaler) Marshal(data interface{}) ([]byte, error)
func (GOBMarshaler) Unmarshal ¶
func (GOBMarshaler) Unmarshal(data []byte, target interface{}) error
type JSONMarshaler ¶
type JSONMarshaler struct{}
func (JSONMarshaler) Marshal ¶
func (JSONMarshaler) Marshal(data interface{}) ([]byte, error)
func (JSONMarshaler) Unmarshal ¶
func (JSONMarshaler) Unmarshal(bytes []byte, target interface{}) error
type Mapper ¶
type Mapper[T any] interface { // New returns a new instance of a transport model // corresponding to the provided event name. New(eventName string) (any, error) // FromTransport maps corresponding transport model // into an instance of an esja.Event. FromTransport(ctx context.Context, eventName string, transportEvent any) (esja.Event[T], error) // ToTransport maps an esja.Event into an instance of // a corresponding transport model. ToTransport(ctx context.Context, eventName string, event esja.Event[T]) (any, error) }
Mapper translates the event into a serializable transport model.
type NoOpMapper ¶
type NoOpMapper[T any] struct { // contains filtered or unexported fields }
NoOpMapper implements an interface of transport.Mapper The mapper will use provided original stream events as transport models.
func NewNoOpMapper ¶
func NewNoOpMapper[T any]( supportedEvents []esja.Event[T], ) NoOpMapper[T]
NewNoOpMapper returns a new instance of NoOpMapper.
func (NoOpMapper[T]) FromTransport ¶
func (NoOpMapper[T]) ToTransport ¶
type StructAnonymizer ¶
type StructAnonymizer interface { // Anonymize encrypts struct properties using secrets // correlated with a provided stream ID. Anonymize(ctx context.Context, key string, data any) (any, error) // Deanonymize decrypts struct properties using secrets // correlated with a provided stream ID. Deanonymize(ctx context.Context, key string, data any) (any, error) }
StructAnonymizer is an interface of the anonymizer component.