structure

package module
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 3

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