Documentation
¶
Index ¶
- func Sync(ctx *context.Context, set FeatureSet)
- type FeatureInfo
- type FeatureSet
- type StateData
- type StateManager
- func (s *StateManager) ForgetEnv()
- func (s *StateManager) GetActiveFeatures() FeatureSet
- func (s *StateManager) GetProjectSlug() string
- func (s *StateManager) RestoreEnv()
- func (s *StateManager) SaveEnv()
- func (s *StateManager) SetFeature(featureInfo *FeatureInfo)
- func (s *StateManager) SetProjectSlug(slug string)
- func (s *StateManager) UnsetFeature(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sync ¶
func Sync(ctx *context.Context, set FeatureSet)
Sync activates / deactivates the features in the instance of env.Env. When a feature is already active but unknown, it will be ignored completely. When a param changes, the feature is deactivated with the current param then activated with the new param.
Types ¶
type FeatureInfo ¶
FeatureInfo represents a parameterized feature
func NewFeatureInfo ¶
func NewFeatureInfo(name string, param string) *FeatureInfo
NewFeatureInfo returns a FeatureInfo
func (FeatureInfo) String ¶ added in v0.10.0
func (f FeatureInfo) String() string
type FeatureSet ¶
type FeatureSet []*FeatureInfo
FeatureSet represents a set of parameterized features
func (FeatureSet) Get ¶ added in v0.10.0
func (s FeatureSet) Get(name string) *FeatureInfo
Get returns a new FeatureSet augmented with the featureInfo provided
func (FeatureSet) String ¶ added in v0.10.0
func (s FeatureSet) String() string
func (FeatureSet) With ¶
func (s FeatureSet) With(featureInfo *FeatureInfo) FeatureSet
With returns a new FeatureSet augmented with the featureInfo provided
func (FeatureSet) Without ¶
func (s FeatureSet) Without(name string) FeatureSet
Without returns a new FeatureSet augmented with the featureInfo provided
type StateData ¶ added in v0.10.0
type StateData struct {
ProjectSlug string `json:"project"`
Features FeatureSet `json:"features"`
SavedEnv savedEnv `json:"saved_env"`
}
type StateManager ¶ added in v0.10.0
StateManager remember the current state of the features (whether they are active)
func (*StateManager) ForgetEnv ¶ added in v0.10.0
func (s *StateManager) ForgetEnv()
ForgetEnv clears the environment mutations previously recorded in the state
func (*StateManager) GetActiveFeatures ¶ added in v0.10.0
func (s *StateManager) GetActiveFeatures() FeatureSet
GetActiveFeatures returns the FeatureSet recorded in the state
func (*StateManager) GetProjectSlug ¶ added in v0.10.0
func (s *StateManager) GetProjectSlug() string
GetProjectSlug returns the slug of the project in which DevBuddy was when the state was written
func (*StateManager) RestoreEnv ¶ added in v0.10.0
func (s *StateManager) RestoreEnv()
RestoreEnv reverts the environment as recorded in the state
func (*StateManager) SaveEnv ¶ added in v0.10.0
func (s *StateManager) SaveEnv()
SaveEnv records the environment mutations in the state
func (*StateManager) SetFeature ¶ added in v0.10.0
func (s *StateManager) SetFeature(featureInfo *FeatureInfo)
SetFeature marks a feature as active
func (*StateManager) SetProjectSlug ¶ added in v0.10.0
func (s *StateManager) SetProjectSlug(slug string)
SetProjectSlug records the project slug in the state
func (*StateManager) UnsetFeature ¶ added in v0.10.0
func (s *StateManager) UnsetFeature(name string)
UnsetFeature marks a feature as inactive