json

package
v0.0.0-...-4a59535 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColoredPrettyPrint

func ColoredPrettyPrint(data interface{}) string

func DecodeWithMapStructure

func DecodeWithMapStructure(
	input interface{},
	output interface{},
) error

DecodeWithMapStructure is a wrapper around mapstructure.Decode. Decode takes an input structure or map[string]interface{} and uses reflection to translate it to the output structure. output must be a pointer to a map or struct. https://pkg.go.dev/github.com/mitchellh/mapstructure#section-readme

func Marshal

func Marshal(v interface{}) ([]byte, error)

func NewDefaultEventJsonSerializer

func NewDefaultEventJsonSerializer(serializer serializer.Serializer) serializer.EventSerializer

func NewDefaultJsonSerializer

func NewDefaultJsonSerializer() serializer.Serializer

func NewDefaultMetadataJsonSerializer

func NewDefaultMetadataJsonSerializer(serializer serializer.Serializer) serializer.MetadataSerializer

func PrettyPrint

func PrettyPrint(data interface{}) string

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal is a wrapper around json.Unmarshal. To unmarshal JSON into an interface value, Unmarshal stores in a map[string]interface{}

func UnmarshalFromJSON

func UnmarshalFromJSON(data string, v interface{}) error

UnmarshalFromJSON is a wrapper around json.Unmarshal.

func UnmarshalToMap

func UnmarshalToMap(
	data []byte,
	v *map[string]interface{},
) error

func UnmarshalToMapFromJson

func UnmarshalToMapFromJson(
	data string,
	v *map[string]interface{},
) error

Types

type DefaultEventJsonSerializer

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

func (*DefaultEventJsonSerializer) ContentType

func (s *DefaultEventJsonSerializer) ContentType() string

func (*DefaultEventJsonSerializer) Deserialize

func (s *DefaultEventJsonSerializer) Deserialize(
	data []byte,
	eventType string,
	contentType string,
) (domain.IDomainEvent, error)

func (*DefaultEventJsonSerializer) DeserializeObject

func (s *DefaultEventJsonSerializer) DeserializeObject(
	data []byte,
	eventType string,
	contentType string,
) (interface{}, error)

func (*DefaultEventJsonSerializer) DeserializeType

func (s *DefaultEventJsonSerializer) DeserializeType(
	data []byte,
	eventType reflect.Type,
	contentType string,
) (domain.IDomainEvent, error)

func (*DefaultEventJsonSerializer) Serialize

func (*DefaultEventJsonSerializer) SerializeObject

func (s *DefaultEventJsonSerializer) SerializeObject(event interface{}) (*serializer.EventSerializationResult, error)

func (*DefaultEventJsonSerializer) Serializer

type DefaultMessageJsonSerializer

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

func (*DefaultMessageJsonSerializer) ContentType

func (m *DefaultMessageJsonSerializer) ContentType() string

func (*DefaultMessageJsonSerializer) Deserialize

func (m *DefaultMessageJsonSerializer) Deserialize(
	data []byte,
	messageType string,
	contentType string,
) (types.IMessage, error)

func (*DefaultMessageJsonSerializer) DeserializeObject

func (m *DefaultMessageJsonSerializer) DeserializeObject(
	data []byte,
	messageType string,
	contentType string,
) (interface{}, error)

func (*DefaultMessageJsonSerializer) DeserializeType

func (m *DefaultMessageJsonSerializer) DeserializeType(
	data []byte,
	messageType reflect.Type,
	contentType string,
) (types.IMessage, error)

func (*DefaultMessageJsonSerializer) Serialize

func (*DefaultMessageJsonSerializer) SerializeEnvelop

func (*DefaultMessageJsonSerializer) SerializeObject

func (m *DefaultMessageJsonSerializer) SerializeObject(
	message interface{},
) (*serializer.EventSerializationResult, error)

func (*DefaultMessageJsonSerializer) Serializer

type DefaultMetadataJsonSerializer

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

func (*DefaultMetadataJsonSerializer) Deserialize

func (s *DefaultMetadataJsonSerializer) Deserialize(bytes []byte) (metadata.Metadata, error)

func (*DefaultMetadataJsonSerializer) Serialize

func (s *DefaultMetadataJsonSerializer) Serialize(meta metadata.Metadata) ([]byte, error)

Jump to

Keyboard shortcuts

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