Help us shape the future of Go! Take the 2026 Go Developer Survey

autobind

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ViperTag = "viper"
	CobraTag = "cobra"
	EnvTag   = "env"
)

Variables

This section is empty.

Functions

func AutoBind

func AutoBind(vp *viper.Viper, cfg interface{}) func(cmd *cobra.Command, args []string) error

Types

type Autobinder added in v0.0.2

type Autobinder struct {
	ConfigObject interface{}
	Viper        *viper.Viper
	UseNesting   bool
	EnvPrefix    string            // Viper prefix for environment variables, viper does not expose this, and because we construct the ENV variables, the prefix isn't set by Viper.
	SetDefaults  bool              // Set default values for Viper keys that are not set
	Casters      map[string]Caster // Custom casters
}

func (*Autobinder) Bind added in v0.0.2

func (b *Autobinder) Bind(ctx context.Context, cmd *cobra.Command, prefix []string)

func (*Autobinder) Cast added in v0.0.8

func (b *Autobinder) Cast(key string, caster Caster)

type Caster added in v0.0.8

type Caster func(interface{}) interface{}

Jump to

Keyboard shortcuts

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