Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
// GetFeatureFlags returns list of features or an empty list otherwise.
GetFeatureFlags() ([]FeatureFlag, error)
// GetFeatureFlag returns an specific feature or engine.NotFoundError when it's not found.
GetFeatureFlag(FeatureFlagKey) (*FeatureFlag, error)
// UpsertFeatureFlag updates or inserts the feature flag.
UpsertFeatureFlag(FeatureFlag) error
// DeleteFeatureFlag deletes an specific feature flag or returns engine.NotFoundError when it's not found.
DeleteFeatureFlag(FeatureFlagKey) error
}
Storage interface.
type FeatureFlag ¶
type FeatureFlag struct {
Enabled bool `json:"enabled"`
Key string `json:"key"`
Users []*User `json:"users,omitempty"`
Percentage uint32 `json:"percentage"`
}
func NewFeatureFlag ¶
func (*FeatureFlag) ContainsUser ¶
func (ff *FeatureFlag) ContainsUser(user *User) bool
func (*FeatureFlag) UserInPercentage ¶
func (ff *FeatureFlag) UserInPercentage(user *User) bool
type FeatureFlagKey ¶
type FeatureFlagKey struct {
Key string
}
type NotFoundError ¶
type NotFoundError struct {
Message string
}
func (*NotFoundError) Error ¶
func (n *NotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.