Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var File_envelope_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
Key *string `protobuf:"bytes,1,opt,name=getKey" json:"getKey,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload" json:"payload,omitempty"`
// contains filtered or unexported fields
}
func (*Envelope) Descriptor
deprecated
func (*Envelope) GetPayload ¶
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
type ErrFactoryDoesNotReturnPointer ¶
type ErrFactoryDoesNotReturnPointer string
func (ErrFactoryDoesNotReturnPointer) Error ¶
func (e ErrFactoryDoesNotReturnPointer) Error() string
type ErrFactoryReturnsNil ¶
type ErrFactoryReturnsNil string
func (ErrFactoryReturnsNil) Error ¶
func (e ErrFactoryReturnsNil) Error() string
type ErrReregisteredKey ¶
type ErrReregisteredKey string
func (ErrReregisteredKey) Error ¶
func (e ErrReregisteredKey) Error() string
type ErrUnregisteredKey ¶
type ErrUnregisteredKey string
func (ErrUnregisteredKey) Error ¶
func (e ErrUnregisteredKey) Error() string
type JsonSerde ¶
type JsonSerde struct{}
JsonSerde is a Serde implementation for JSON
It uses the encoding/json package to serialize and deserialize data.
type ProtoSerde ¶
type ProtoSerde struct{}
ProtoSerde is a Serde implementation for Protocol Buffers
It uses the google.golang.org/protobuf/proto package to serialize and deserialize data.
func (ProtoSerde) Deserialize ¶
func (s ProtoSerde) Deserialize(data []byte, v any) error
type Registry ¶
type Registry interface {
Register(vs ...any) error
RegisterFactory(fns ...func() any) error
Serialize(v any) ([]byte, error)
Deserialize(data []byte) (any, error)
IsRegistered(v any) bool
Build(key string) (any, error)
}
func NewRegistry ¶
func NewRegistry(opts ...RegistryOption) Registry
NewRegistry creates a new envelope registry.
The registry is used to register types that can be serialized as concrete types, then deserialized back into their original types without knowing ahead of time what those types are.
type RegistryOption ¶
type RegistryOption func(*registry)
func WithEnvelopeSerde ¶
func WithEnvelopeSerde(serde Serde) RegistryOption
func WithSerde ¶
func WithSerde(serde Serde) RegistryOption
Click to show internal directories.
Click to hide internal directories.