mapstruct

package
v0.22.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

mapstruct is similar in idea to mitchellh/mapstructure, with a difference that values are assumed to always be created through json serialization.

Eg. If one would try to directly convert some struct to map[string]any via mapstructure, resulting map wouldn't necessary match json representation of said object, especially if custom UnmarshalJSON are present. Object created by EncodeObject avoids such mismatch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object map[string]any

Object is an in-memory representation of JSON object.

func EncodeObject

func EncodeObject(obj any) (Object, error)

EncodeObject encodes any json-serializable struct as Object

json.Unmarshal(obj) and json.Unmarshal(returnedObject) should be equivalent.

Jump to

Keyboard shortcuts

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