serde

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 0 Imported by: 4

Documentation

Overview

Package serde contains interfaces used for serialization and deserialization throughout the eventually library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes[Src any] interface {
	Serde[Src, []byte]
}

Bytes is a Serde implementation used to serialize a Source type to and deserialize it from a byte array.

type BytesDeserializer

type BytesDeserializer[Src any] interface {
	Deserializer[Src, []byte]
}

BytesDeserializer is a specialized Deserializer to deserialize a Source type from a byte array.

type BytesSerializer

type BytesSerializer[Src any] interface {
	Serializer[Src, []byte]
}

BytesSerializer is a specialized Serializer to serialize a Source type into a byte array.

type Deserializer

type Deserializer[Src any, Dst any] interface {
	Deserialize(dst Dst) (Src, error)
}

Deserializer is used to deserialize a Source type from another Destination type.

type DeserializerFunc

type DeserializerFunc[Src any, Dst any] func(dst Dst) (Src, error)

DeserializerFunc is a functional implementation of the Deserializer interface.

func (DeserializerFunc[Src, Dst]) Deserialize

func (fn DeserializerFunc[Src, Dst]) Deserialize(dst Dst) (Src, error)

Deserialize implements the serde.Deserializer interface.

type Fused

type Fused[Src any, Dst any] struct {
	Serializer[Src, Dst]
	Deserializer[Src, Dst]
}

Fused provides a convenient way to fuse together different implementations of a Serializer and Deserializer, and use it as a Serde.

type Serde

type Serde[Src any, Dst any] interface {
	Serializer[Src, Dst]
	Deserializer[Src, Dst]
}

Serde is used to serialize and deserialize from a Source to a Destination type.

type Serializer

type Serializer[Src any, Dst any] interface {
	Serialize(src Src) (Dst, error)
}

Serializer is used to serialize a Source type into another Destination type.

type SerializerFunc

type SerializerFunc[Src any, Dst any] func(src Src) (Dst, error)

SerializerFunc is a functional implementation of the Serializer interface.

func (SerializerFunc[Src, Dst]) Serialize

func (fn SerializerFunc[Src, Dst]) Serialize(src Src) (Dst, error)

Serialize implements the serde.Serializer interface.

Jump to

Keyboard shortcuts

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