Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownFeature = errors.New("unknown feature flag")
ErrUnknownFeature is returned when a caller references a flag that has not been registered.
Functions ¶
func ContextWithFlags ¶
ContextWithFlags stores the resolved flags on the provided context.
func EnabledFromEnv ¶
EnabledFromEnv scans the current environment (or the provided list) for TORQUE_FEATURE_* values.
Types ¶
type Definition ¶
Definition tracks the metadata for a feature flag.
func DefinitionByName ¶
func DefinitionByName(name Name) (Definition, bool)
DefinitionByName returns the definition for the provided feature.
func Definitions ¶
func Definitions() []Definition
Definitions returns the full set of registered flags in alphabetical order.
func (Definition) EnvVar ¶
func (d Definition) EnvVar() string
EnvVar returns the environment variable that toggles the flag (e.g. TORQUE_FEATURE_FOO).
type Flags ¶
type Flags struct {
// contains filtered or unexported fields
}
Flags captures the resolved state of all feature flags for a torque invocation.
func FromContext ¶
FromContext extracts the feature flag set from a context. The return value is safe to use even when no flags were stored.
func (Flags) EnabledNames ¶
EnabledNames returns the currently enabled flag names in alphabetical order.