Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigFromContext ¶
ConfigFromContext retrieves a configuration registry from the context.
An optional defaulter can be added to deal with a non-existing config.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config can wrap a viper.Viper configuration in the context
func (Config) FromContext ¶
type ContextInjectable ¶
type ContextInjectable interface {
// Context builds a context with the injected value
Context(context.Context) context.Context
// FromContext retrieves the injected value from the context.
//
// It should work even if the receiver is zero value.
FromContext(context.Context) interface{}
}
ContextInjectable knows how to retrieve a value from a Context.
Users of the github.com/fredbi/go-cli/cli package can define their own injections via the context.
NOTE: every such type should declare their own key type to avoid conflicts inside the context.
For example:
type commandCtxKey uint8 const ctxConfig commandCtxKey = iota + 1
type SLogger ¶ added in v0.1.3
type SLogger struct {
// contains filtered or unexported fields
}
func NewSLogger ¶ added in v0.1.3
func (SLogger) FromContext ¶ added in v0.1.3
Click to show internal directories.
Click to hide internal directories.