confutil

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTagsFound                  = errors.New("no tags found")
	ErrUnsupportedKind              = errors.New("unsupported kind")
	ErrCantCastVariableToTargetType = errors.New("can't cast variable")
	ErrResolverNotRegistered        = errors.New("unknown tag type")
)
View Source
var ErrEnvVariableNotProvided error = errors.New("env variable not set")

Functions

func IsChosenCase

func IsChosenCase(checkCase string, chosenCases []string) bool

Creates filter that returns true if ammo tag is in chosenCases. If no chosenCases provided - returns true

func RegisterTagResolver

func RegisterTagResolver(tagType string, resolver TagResolver)

Register custom tag resolver for config variables

func ResolveCustomTags

func ResolveCustomTags(s string, targetType reflect.Type) (interface{}, error)

Resolve config variables in format ${tagType:variable}

Types

type TagResolver

type TagResolver func(string) (string, error)
var EnvTagResolver TagResolver = envTokenResolver

Resolve custom tag token with env variable value

Jump to

Keyboard shortcuts

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