mapstructx

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HCLHookFunc added in v0.5.1

func HCLHookFunc() mapstructure.DecodeHookFunc

HCLHookFunc returns a mapstructure.DecodeHookFunc that helps unmarshal HCL configs by allowing weakly typed fields where slices are typically expected.

func Marshal added in v0.5.1

func Marshal(
	v zero.Interface,
	opts ...DecoderConfigOption,
) (map[string]zero.Interface, error)

Marshal marshals v into a map[string]interface{}.

func Unmarshal

func Unmarshal(
	src zero.Interface,
	dst zero.Interface,
	opts ...DecoderConfigOption,
) error

Unmarshal unmarshals the data from src into the value pointed to by dst.

func UnmarshalerHookFunc

func UnmarshalerHookFunc() mapstructure.DecodeHookFunc

UnmarshalerHookFunc returns a mapstructure.DecodeHookFunc that lets destination types that implement the Unmarshaler interface decode themselves.

Types

type DecoderConfigOption

type DecoderConfigOption = viper.DecoderConfigOption

A DecoderConfigOption modifies a mapstructure.DecoderConfig.

func ReplaceDecodeHook added in v0.5.1

func ReplaceDecodeHook(hook ...mapstructure.DecodeHookFunc) DecoderConfigOption

ReplaceDecodeHook creates a DecoderConfigOption that replaces the existing decode hooks on the DecoderConfig.

func WithDecodeHook added in v0.5.1

func WithDecodeHook(hook ...mapstructure.DecodeHookFunc) DecoderConfigOption

WithDecodeHook creates a DecoderConfigOption that attaches appends to the existing hooks on the DecoderConfig.

func WithTagName

func WithTagName(name string) DecoderConfigOption

WithTagName configures a mapstructure.Decoder to use struct tags named name.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalMap(v zero.Interface) error
}

An Unmarshaler knows how to unmarshal itself from a map structure.

Jump to

Keyboard shortcuts

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