Documentation ¶
Index ¶
- Variables
- type KindMarshaler
- func (t KindMarshaler[D]) Marshal(val any) ([]byte, error)
- func (t *KindMarshaler[D]) RegisterNamer(namer TypeNamer) error
- func (t *KindMarshaler[D]) RegisterType(discriminator string, typ reflect.Type) error
- func (t *KindMarshaler[D]) RegisterValue(discriminator string, val any) error
- func (t KindMarshaler[D]) Unmarshal(data []byte) (any, error)
- type TypeNamer
- type TypedMarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKindMarshalerTypeMissing = errorer.New("type missing") ErrKindMarshalerTypeNotRegistered = errorer.New("type not registered") ErrKindMarshalerTypeNotRegisteredv = ErrKindMarshalerTypeNotRegistered.ValueFn() ErrKindMarshalerTypeAlreadyRegistered = errorer.New("type already registered") ErrKindMarshalerTypeAlreadyRegisteredv = ErrKindMarshalerTypeAlreadyRegistered.ValueFn() )
View Source
var ( ErrTypedMarshalerTypeMissing = errorer.New("type missing") ErrTypedMarshalerTypeNotRegistered = errorer.New("type not registered") ErrTypedMarshalerTypeNotRegisteredv = ErrTypedMarshalerTypeNotRegistered.ValueFn() ErrTypedMarshalerTypeAlreadyRegistered = errorer.New("type already registered") ErrTypedMarshalerTypeAlreadyRegisteredv = ErrTypedMarshalerTypeAlreadyRegistered.ValueFn() )
Functions ¶
This section is empty.
Types ¶
type KindMarshaler ¶ added in v1.0.29
func NewKind ¶ added in v1.0.29
func NewKind[D any](val D, fn func(D) string) *KindMarshaler[D]
func (KindMarshaler[D]) Marshal ¶ added in v1.0.29
func (t KindMarshaler[D]) Marshal(val any) ([]byte, error)
func (*KindMarshaler[D]) RegisterNamer ¶ added in v1.0.29
func (t *KindMarshaler[D]) RegisterNamer(namer TypeNamer) error
func (*KindMarshaler[D]) RegisterType ¶ added in v1.0.29
func (t *KindMarshaler[D]) RegisterType(discriminator string, typ reflect.Type) error
func (*KindMarshaler[D]) RegisterValue ¶ added in v1.0.29
func (t *KindMarshaler[D]) RegisterValue(discriminator string, val any) error
type TypedMarshaler ¶ added in v1.0.29
type TypedMarshaler struct {
// contains filtered or unexported fields
}
func NewTyped ¶ added in v1.0.29
func NewTyped() *TypedMarshaler
func (TypedMarshaler) Marshal ¶ added in v1.0.29
func (t TypedMarshaler) Marshal(namer TypeNamer) ([]byte, error)
func (*TypedMarshaler) Register ¶ added in v1.0.29
func (t *TypedMarshaler) Register(namers ...TypeNamer) error
Click to show internal directories.
Click to hide internal directories.