Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FeatureFlag ¶
type FeatureFlag struct {
// The key of a feature flag
Key string `json:"key"`
// A description of the feature to be displayed in the UI
Description string `json:"description"`
// Tell if a feature flag is enabled. If set to false,
// the feature flag can still be partially enabled thanks to
// the Users, Groups and Percentage properties
Enabled bool `json:"enabled"`
// Gives access to a feature to specific user IDs
Users []string `json:"users"`
// Gives access to a feature to specific groups
Groups []string `json:"groups"`
// Gives access to a feature to a percentage of users
Percentage uint32 `json:"percentage"`
}
Represents a feature flag
func (FeatureFlag) GroupHasAccess ¶
func (f FeatureFlag) GroupHasAccess(group string) bool
GroupHasAccess checks if a group has access to a feature
func (FeatureFlag) IsEnabled ¶
func (f FeatureFlag) IsEnabled() bool
IsEnabled checks if a feature flag is enabled
func (FeatureFlag) IsPartiallyEnabled ¶
func (f FeatureFlag) IsPartiallyEnabled() bool
IsPartiallyEnabled checks if a feature flag is partially enabled
func (FeatureFlag) UserHasAccess ¶
func (f FeatureFlag) UserHasAccess(user string) bool
UserHasAccess checks if a user has access to a feature
func (FeatureFlag) Validate ¶
func (f FeatureFlag) Validate() error
Self validate the properties of a feature flag
type FeatureFlags ¶
type FeatureFlags []FeatureFlag
Click to show internal directories.
Click to hide internal directories.