structure

package module
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 5 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package structure defines a helper to retrieve structured data from the config

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalKey

func UnmarshalKey(cfg model.Reader, key string, target interface{}, opts ...UnmarshalKeyOption) error

UnmarshalKey retrieves data from the config at the given key and deserializes it to be stored on the target struct.

Types

type UnmarshalKeyOption

type UnmarshalKeyOption func(*featureSet)

UnmarshalKeyOption is an option that affects the enabled features in UnmarshalKey

var ConvertEmptyStringToNil UnmarshalKeyOption = func(fs *featureSet) {
	fs.convertEmptyStrNil = true
}

ConvertEmptyStringToNil allows UnmarshalKey to implicitly convert empty strings into nil slices

var EnableSquash UnmarshalKeyOption = func(fs *featureSet) {
	fs.allowSquash = true
}

EnableSquash allows UnmarshalKey to take advantage of `mapstructure`s `squash` feature a squashed field hoists its fields up a level in the marshalled representation and directly embeds them

var EnableStringUnmarshal UnmarshalKeyOption = func(fs *featureSet) {
	fs.stringUnmarshal = true
}

EnableStringUnmarshal allows UnmarshalKey to handle stringified json and Unmarshal it

var ErrorUnused UnmarshalKeyOption = func(fs *featureSet) {
	fs.errorUnused = true
}

ErrorUnused allows UnmarshalKey to return an error if there are unused keys in the config.

var ImplicitlyConvertArrayToMapSet UnmarshalKeyOption = func(fs *featureSet) {
	fs.convertArrayToMap = true
}

ImplicitlyConvertArrayToMapSet allows UnmarshalKey to implicitly convert an array of []interface{} to a map[interface{}]bool

Jump to

Keyboard shortcuts

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