Documentation ¶
Index ¶
- Constants
- Variables
- func CallMergeFunc(f StructMethod) error
- func CallParseFunc(f StructMethod, i interface{}) (interface{}, error)
- func CallValidateFunc(f StructMethod) error
- func GetFlagValue(item *Item) (reflect.Value, error)
- func GetKeysFromViperConfig(group string, format string, v *viper.Viper, r io.Reader) ([]string, error)
- func NormalizeVar(s string, sep string) string
- func SetLogging(level logging.Lvl, handler logging.Handler)
- type BaseGroup
- type Error
- type Group
- type Item
- func (c *Item) EnableFlag() bool
- func (c *Item) EnvName(prefix string) string
- func (c *Item) FlagName() string
- func (c *Item) FullName() string
- func (c *Item) Merge() (string, error)
- func (c *Item) Name() string
- func (c *Item) Parse(i interface{}) (interface{}, error)
- func (c *Item) ParseEnv(i string) (interface{}, error)
- func (c Item) String() string
- func (c *Item) Validate() (string, error)
- type Manager
- func (m *Manager) Cobra() *cobra.Command
- func (m *Manager) Config() interface{}
- func (m *Manager) ConfigPprint() (o []interface{})
- func (m *Manager) ConfigString() string
- func (m *Manager) EnvName(item *Item) string
- func (m *Manager) Envs() []string
- func (m *Manager) FlagSet() *pflag.FlagSet
- func (m *Manager) Get(key string) (*Item, bool)
- func (m *Manager) GetValue(key string, i interface{}) error
- func (m *Manager) Group() string
- func (m *Manager) Groups() []string
- func (m *Manager) ItemByFlag(flag string) (*Item, bool)
- func (m *Manager) Map() map[string]*Item
- func (m *Manager) Merge() (string, error)
- func (m *Manager) MergeFromEnv() (string, error)
- func (m *Manager) MergeFromFlags() (string, error)
- func (m *Manager) MergeFromViper() (string, error)
- func (m *Manager) Root() *Item
- func (m *Manager) SetEnvLookupFunc(fn func(string) (string, bool))
- func (m *Manager) SetRaw(key string, i interface{}) error
- func (m *Manager) SetUseEnv(s bool)
- func (m *Manager) SetValue(key string, i interface{}) error
- func (m *Manager) SetViperConfig(format string, b []byte) error
- func (m *Manager) SetViperConfigFile(fs ...string) error
- func (m *Manager) UseEnv() bool
- func (m *Manager) Viper() *viper.Viper
- func (m *Manager) ViperString(format string) (string, error)
- type StructMethod
Constants ¶
View Source
const ( ErrorMethodNotFoundCode ErrorInvalidMethodCode )
Variables ¶
View Source
var (
ErrorMethodNotFound, _ = NewError(ErrorMethodNotFoundCode, "method not found")
ErrorInvalidMethod, _ = NewError(ErrorInvalidMethodCode, "invalid method found")
)
Functions ¶
func CallMergeFunc ¶
func CallMergeFunc(f StructMethod) error
func CallParseFunc ¶
func CallParseFunc(f StructMethod, i interface{}) (interface{}, error)
func CallValidateFunc ¶
func CallValidateFunc(f StructMethod) error
func GetKeysFromViperConfig ¶
func NormalizeVar ¶
Types ¶
type BaseGroup ¶
type BaseGroup struct{}
func (*BaseGroup) ThisIsGroup ¶
func (b *BaseGroup) ThisIsGroup()
type Item ¶
type Item struct { FieldName string Value reflect.Value Group *Item Children []*Item Tag reflect.StructTag Input interface{} IsGroup bool ViperName string }
func (*Item) EnableFlag ¶
type Manager ¶
func NewManager ¶
func (*Manager) ConfigPprint ¶
func (m *Manager) ConfigPprint() (o []interface{})
func (*Manager) ConfigString ¶
func (*Manager) MergeFromEnv ¶
func (*Manager) MergeFromFlags ¶
func (*Manager) MergeFromViper ¶
func (*Manager) SetEnvLookupFunc ¶
func (*Manager) SetViperConfigFile ¶
type StructMethod ¶
func GetFuncFromItem ¶
func GetFuncFromItem(item *Item, name string, numIn, numOut int) []StructMethod
func GetFuncFromItemStruct ¶
func GetFuncFromItemStruct(item *Item, name string, numIn, numOut int) []StructMethod
func GetMethodByName ¶
func GetMethodByName(i interface{}, name string, numIn, numOut int) (m StructMethod, found bool)
func (StructMethod) Empty ¶
func (m StructMethod) Empty() bool
func (StructMethod) NumIn ¶
func (m StructMethod) NumIn() int
func (StructMethod) NumOut ¶
func (m StructMethod) NumOut() int
Click to show internal directories.
Click to hide internal directories.