serialize

package
v3.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Marshaler

type Marshaler interface {
	Marshal(interface{}) ([]byte, error)
}

Marshaler represents a marshal interface

type Serializer

type Serializer interface {
	Marshaler
	Unmarshaler
	GetName() string
}

Serializer is the interface that groups the basic Marshal and Unmarshal methods.

func NewSerializer

func NewSerializer(serializerType Type) (Serializer, error)

NewSerializer returns a new serializer of the respective type (JSON or PROTOBUF) according to serializerType Type. If serializerType is a JSON, then a JSON serializer is returned. If serializerType is a PROTOBUF, then a PROTOBUF serializer is returned. Otherwise, if serializerType is not a valid serializer type, then it returns nil.

type Type

type Type uint16

Type is the Serializer type.

const (
	JSON     Type = 1
	PROTOBUF Type = 2
)

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]byte, interface{}) error
}

Unmarshaler represents a Unmarshal interface

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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