codecs

package
v0.0.0-...-9245cf0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GobSerializer

type GobSerializer struct{}

GobSerializer - gob based serializer

func (*GobSerializer) Decode

func (s *GobSerializer) Decode(data []byte, target interface{}) error

Decode - decodes given bytes into target struct

func (*GobSerializer) Encode

func (s *GobSerializer) Encode(source interface{}) ([]byte, error)

Encode - encodes source into bytes using Gob encoder

type JSONSerializer

type JSONSerializer struct{}

JSONSerializer - JSON based serializer

func (*JSONSerializer) Decode

func (s *JSONSerializer) Decode(data []byte, target interface{}) error

Decode - decodes given bytes into target struct

func (*JSONSerializer) Encode

func (s *JSONSerializer) Encode(source interface{}) ([]byte, error)

Encode - encodes source into bytes using JSON encoder

func (*JSONSerializer) Type

func (s *JSONSerializer) Type() string

Type - shows serializer type

type Serializer

type Serializer interface {
	Encode(source interface{}) ([]byte, error)
	Decode(data []byte, target interface{}) error
}

Serializer - generic serializer interface

func DefaultSerializer

func DefaultSerializer() Serializer

DefaultSerializer - returns default serializer

Jump to

Keyboard shortcuts

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