Documentation
¶
Index ¶
- Variables
- func ParseStruct(ctx context.Context, s interface{}, failOnParseError bool) error
- type EnvironmentParser
- func (e EnvironmentParser) GetBoolean(ctx context.Context, name string) (bool, error)
- func (e EnvironmentParser) GetFloat(ctx context.Context, name string) (float64, error)
- func (e EnvironmentParser) GetInt(ctx context.Context, name string) (int64, error)
- func (e EnvironmentParser) GetString(ctx context.Context, name string) (string, error)
- func (e EnvironmentParser) GetStringSlice(ctx context.Context, name string) ([]string, error)
- type ErrEnvVariableNotFound
- type ErrFlagNotFound
- type FieldParser
- type FlagParser
- func (p FlagParser) GetBoolean(ctx context.Context, name string) (bool, error)
- func (p FlagParser) GetFloat(ctx context.Context, name string) (float64, error)
- func (p FlagParser) GetInt(ctx context.Context, name string) (int64, error)
- func (p FlagParser) GetString(ctx context.Context, name string) (string, error)
- func (p FlagParser) GetStringSlice(ctx context.Context, name string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFlagsNotFound = errors.New("flags not found in cobra context")
View Source
var ErrNotUsingCobraCtx = errors.New("flag parser called without cobra context")
View Source
var FieldParsers = map[string]FieldParser{ // contains filtered or unexported fields }
FieldParsers is a collection of tags to parsers for the parser to use
Functions ¶
Types ¶
type EnvironmentParser ¶
type EnvironmentParser struct { }
func (EnvironmentParser) GetBoolean ¶
GetBoolean returns an environment variable as a boolean
func (EnvironmentParser) GetStringSlice ¶
type ErrEnvVariableNotFound ¶
type ErrEnvVariableNotFound struct {
// contains filtered or unexported fields
}
func (ErrEnvVariableNotFound) Error ¶
func (e ErrEnvVariableNotFound) Error() string
type ErrFlagNotFound ¶
type ErrFlagNotFound struct {
// contains filtered or unexported fields
}
func (ErrFlagNotFound) Error ¶
func (e ErrFlagNotFound) Error() string
type FieldParser ¶
type FieldParser interface { GetString(ctx context.Context, tagValue string) (string, error) GetInt(ctx context.Context, tagValue string) (int64, error) GetFloat(ctx context.Context, tagValue string) (float64, error) GetBoolean(ctx context.Context, tagValue string) (bool, error) GetStringSlice(ctx context.Context, tagValue string) ([]string, error) }
FieldParser is an interface for fetching a field value given a tag value
type FlagParser ¶
type FlagParser struct { }
func (FlagParser) GetBoolean ¶
GetBoolean returns a flag variable as a boolean
func (FlagParser) GetStringSlice ¶
GetStringSlice returns a flag variable as a string slice
Click to show internal directories.
Click to hide internal directories.