marshaller

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarshalError

type MarshalError struct {
	// contains filtered or unexported fields
}

MarshalError represents an error when marshalling fails.

func (MarshalError) Error

func (e MarshalError) Error() string

Error returns a string representation of the marshalling error.

func (MarshalError) Unwrap

func (e MarshalError) Unwrap() error

Unwrap returns the underlying error that caused the marshalling failure.

type Marshallable

type Marshallable interface {
	Marshal() ([]byte, error)
	Unmarshal(data []byte) error
}

Marshallable - custom object serialization, implements for each object. Required for `integrity.Storage` type to set marshalling format to specific object and as recommendation for developers of `Storage` wrappers.

type Marshaller

type Marshaller interface {
	Marshal(data any) ([]byte, error)
	Unmarshal(data []byte, out any) error
}

Marshaller - serialization by default (JSON/Protobuf/etc), implements one time for all objects. Required for `integrity.Storage` to set marshalling format for any type object and as recommendation for developers of `Storage` wrappers.

type TypedMarshaller

type TypedMarshaller[T any] interface {
	Marshal(data T) ([]byte, error)
	Unmarshal(data []byte) (T, error)
}

TypedMarshaller is a generic interface for typed marshalling operations.

type TypedYamlMarshaller

type TypedYamlMarshaller[T any] struct{}

TypedYamlMarshaller is a generic YAML marshaller for typed objects.

func NewTypedYamlMarshaller

func NewTypedYamlMarshaller[T any]() TypedYamlMarshaller[T]

NewTypedYamlMarshaller creates a new TypedYamlMarshaller for the specified type.

func (TypedYamlMarshaller[T]) Marshal

func (m TypedYamlMarshaller[T]) Marshal(data T) ([]byte, error)

Marshal serializes the typed data to YAML format.

func (TypedYamlMarshaller[T]) Unmarshal

func (m TypedYamlMarshaller[T]) Unmarshal(data []byte) (T, error)

Unmarshal deserializes YAML data into a typed object.

type UnmarshalError

type UnmarshalError struct {
	// contains filtered or unexported fields
}

UnmarshalError represents an error when unmarshalling fails.

func (UnmarshalError) Error

func (e UnmarshalError) Error() string

Error returns a string representation of the unmarshalling error.

func (UnmarshalError) Unwrap

func (e UnmarshalError) Unwrap() error

Unwrap returns the underlying error that caused the unmarshalling failure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL