Documentation ¶
Index ¶
- Constants
- Variables
- func FeatureLastUsedInfoID(featureID string, version int32) string
- func GetFeaturesDependedOnTargets(targets []*feature.Feature, all map[string]*feature.Feature) map[string]*feature.Feature
- func GetFeaturesDependsOnTargets(targets []*feature.Feature, all map[string]*feature.Feature) map[string]*feature.Feature
- func HasFeaturesDependsOnTargets(targets []*feature.Feature, all []*feature.Feature) bool
- func SegmentUserID(segmentID string, userID string, state featureproto.SegmentUser_State) string
- func TopologicalSort(features []*feature.Feature) ([]*feature.Feature, error)
- func ValidateFeatureDependencies(fs []*feature.Feature) error
- type Feature
- func (f *Feature) AddClause(rule string, clause *feature.Clause) error
- func (f *Feature) AddClauseValue(rule string, clause string, value string) error
- func (f *Feature) AddPrerequisite(fID, variationID string) error
- func (f *Feature) AddRule(rule *feature.Rule) error
- func (f *Feature) AddTag(tag string) error
- func (f *Feature) AddUserToVariation(variation string, user string) error
- func (f *Feature) AddVariation(id string, value string, name string, description string) error
- func (f *Feature) Archive() error
- func (f *Feature) ChangeClauseAttribute(rule string, clause string, attribute string) error
- func (f *Feature) ChangeClauseOperator(rule string, clause string, operator feature.Clause_Operator) error
- func (f *Feature) ChangeDefaultStrategy(s *feature.Strategy) error
- func (f *Feature) ChangeDescription(description string) error
- func (f *Feature) ChangeFixedStrategy(ruleID string, strategy *feature.FixedStrategy) error
- func (f *Feature) ChangeOffVariation(id string) error
- func (f *Feature) ChangePrerequisiteVariation(fID, variationID string) error
- func (f *Feature) ChangeRolloutStrategy(ruleID string, strategy *feature.RolloutStrategy) error
- func (f *Feature) ChangeRuleStrategy(ruleID string, strategy *feature.Strategy) error
- func (f *Feature) ChangeRulesOrder(ruleIDs []string) error
- func (f *Feature) ChangeVariationDescription(id string, description string) error
- func (f *Feature) ChangeVariationName(id string, name string) error
- func (f *Feature) ChangeVariationValue(id string, value string) error
- func (f *Feature) Clone(maintainer string) (*Feature, error)
- func (f *Feature) Delete() error
- func (f *Feature) DeleteClause(rule string, clause string) error
- func (f *Feature) DeleteRule(rule string) error
- func (f *Feature) Disable() error
- func (f *Feature) Enable() error
- func (f *Feature) FeatureIDsDependsOn() []string
- func (f *Feature) IncrementVersion() error
- func (f *Feature) IsArchivedBeforeLastThirtyDays() bool
- func (f *Feature) IsDisabledAndOffVariationEmpty() bool
- func (f *Feature) IsStale(t time.Time) bool
- func (f *Feature) ListSegmentIDs() []string
- func (f *Feature) RemoveClauseValue(rule string, clause string, value string) error
- func (f *Feature) RemovePrerequisite(fID string) error
- func (f *Feature) RemoveTag(tag string) error
- func (f *Feature) RemoveUserFromVariation(variation string, user string) error
- func (f *Feature) RemoveVariation(id string) error
- func (f *Feature) Rename(name string) error
- func (f *Feature) ResetSamplingSeed() error
- func (f *Feature) Unarchive() error
- func (f *Feature) Update(name, description *wrapperspb.StringValue, tags []string, ...) (*Feature, error)
- type FeatureLastUsedInfo
- type FlagTrigger
- type Mark
- type Segment
- func (s *Segment) AddClause(ruleID string, clause *featureproto.Clause) error
- func (s *Segment) AddClauseValue(ruleID string, clauseID string, value string) error
- func (s *Segment) AddIncludedUserCount(count int64)
- func (s *Segment) AddRule(rule *featureproto.Rule) error
- func (s *Segment) ChangeClauseAttribute(ruleID string, clauseID string, attribute string) error
- func (s *Segment) ChangeClauseOperator(ruleID string, clauseID string, operator featureproto.Clause_Operator) error
- func (s *Segment) ChangeDescription(description string) error
- func (s *Segment) ChangeName(name string) error
- func (s *Segment) DeleteClause(ruleID string, clauseID string) error
- func (s *Segment) DeleteRule(rule string) error
- func (s *Segment) RemoveClauseValue(ruleID string, clauseID string, value string) error
- func (s *Segment) RemoveIncludedUserCount(count int64)
- func (s *Segment) SetDeleted() error
- func (s *Segment) SetIncludedUserCount(count int64)
- func (s *Segment) SetStatus(status featureproto.Segment_Status)
- func (s *Segment) UpdateSegment(name *wrapperspb.StringValue, description *wrapperspb.StringValue) (*Segment, error)
- type SegmentUser
- type Tag
Constants ¶
const (
SecondsToStale = 90 * 24 * 60 * 60 // 90 days
)
Variables ¶
var ( ErrAlreadyEnabled = errors.New("feature: already enabled") ErrAlreadyDisabled = errors.New("feature: already disabled") ErrLastUsedInfoNotFound = errors.New("feature: last used info not found") ErrCycleExists = errors.New("feature: cycle exists in features") ErrFeatureNotFound = errors.New("feature: feature not found") )
Functions ¶
func FeatureLastUsedInfoID ¶
func GetFeaturesDependedOnTargets ¶ added in v0.4.6
func GetFeaturesDependedOnTargets( targets []*feature.Feature, all map[string]*feature.Feature, ) map[string]*feature.Feature
getFeaturesDependedOnTargets returns the features that are depended on the target features. targetFeatures are included in the result.
func GetFeaturesDependsOnTargets ¶ added in v0.4.6
func GetFeaturesDependsOnTargets( targets []*feature.Feature, all map[string]*feature.Feature, ) map[string]*feature.Feature
getFeaturesDependsOnTargets returns the features that depend on the target features. targetFeatures are included in the result.
func HasFeaturesDependsOnTargets ¶ added in v0.4.6
HasFeaturesDependsOnTargets returns true if there are features that depend on the target features. This is a thin wrapper of GetFeaturesDependsOnTargets.
func SegmentUserID ¶
func SegmentUserID(segmentID string, userID string, state featureproto.SegmentUser_State) string
func TopologicalSort ¶
This logic is based on https://en.wikipedia.org/wiki/Topological_sorting. Note: This algorithm is not an exact topological sort because the order is reversed (=from upstream to downstream).
func ValidateFeatureDependencies ¶ added in v0.4.6
Types ¶
type Feature ¶
func NewFeature ¶
func (*Feature) AddClauseValue ¶
func (*Feature) AddPrerequisite ¶
func (*Feature) AddUserToVariation ¶
func (*Feature) AddVariation ¶
func (*Feature) ChangeClauseAttribute ¶
func (*Feature) ChangeClauseOperator ¶
func (*Feature) ChangeDefaultStrategy ¶
func (*Feature) ChangeDescription ¶
func (*Feature) ChangeFixedStrategy ¶
func (f *Feature) ChangeFixedStrategy(ruleID string, strategy *feature.FixedStrategy) error
func (*Feature) ChangeOffVariation ¶
func (*Feature) ChangePrerequisiteVariation ¶
func (*Feature) ChangeRolloutStrategy ¶
func (f *Feature) ChangeRolloutStrategy(ruleID string, strategy *feature.RolloutStrategy) error
func (*Feature) ChangeRuleStrategy ¶
func (*Feature) ChangeRulesOrder ¶ added in v0.4.0
func (*Feature) ChangeVariationDescription ¶
func (*Feature) ChangeVariationName ¶
func (*Feature) ChangeVariationValue ¶
func (*Feature) DeleteRule ¶
func (*Feature) FeatureIDsDependsOn ¶ added in v0.4.5
FeatureIDsDependsOn returns the ids of the features that this feature depends on.
func (*Feature) IncrementVersion ¶
func (*Feature) IsArchivedBeforeLastThirtyDays ¶ added in v0.3.0
IsArchivedBeforeLastThirtyDays returns a bool value indicating whether the feature flag was archived within the last thirty days.
func (*Feature) IsDisabledAndOffVariationEmpty ¶ added in v0.3.0
func (*Feature) ListSegmentIDs ¶
func (*Feature) RemoveClauseValue ¶
func (*Feature) RemovePrerequisite ¶
func (*Feature) RemoveUserFromVariation ¶
func (*Feature) RemoveVariation ¶
func (*Feature) ResetSamplingSeed ¶
func (*Feature) Update ¶ added in v0.4.6
func (f *Feature) Update( name, description *wrapperspb.StringValue, tags []string, enabled *wrapperspb.BoolValue, archived *wrapperspb.BoolValue, variations []*feature.Variation, prerequisites []*feature.Prerequisite, targets []*feature.Target, rules []*feature.Rule, defaultStrategy *feature.Strategy, offVariation *wrapperspb.StringValue, ) (*Feature, error)
Update returns a new Feature with the updated values.
type FeatureLastUsedInfo ¶
type FeatureLastUsedInfo struct {
*feature.FeatureLastUsedInfo
}
func NewFeatureLastUsedInfo ¶
func NewFeatureLastUsedInfo( featureID string, version int32, lastUsedAt int64, clientVersion string, ) *FeatureLastUsedInfo
func (*FeatureLastUsedInfo) ID ¶
func (f *FeatureLastUsedInfo) ID() string
func (*FeatureLastUsedInfo) SetClientVersion ¶
func (f *FeatureLastUsedInfo) SetClientVersion(version string) error
func (*FeatureLastUsedInfo) UsedAt ¶
func (f *FeatureLastUsedInfo) UsedAt(v int64)
type FlagTrigger ¶ added in v0.4.0
type FlagTrigger struct {
*proto.FlagTrigger
}
func NewFlagTrigger ¶ added in v0.4.0
func NewFlagTrigger( environmentId string, cmd *proto.CreateFlagTriggerCommand, ) (*FlagTrigger, error)
func (*FlagTrigger) ChangeDescription ¶ added in v0.4.0
func (ft *FlagTrigger) ChangeDescription(description string) error
func (*FlagTrigger) Disable ¶ added in v0.4.0
func (ft *FlagTrigger) Disable() error
func (*FlagTrigger) Enable ¶ added in v0.4.0
func (ft *FlagTrigger) Enable() error
func (*FlagTrigger) GenerateToken ¶ added in v0.4.0
func (ft *FlagTrigger) GenerateToken() error
func (*FlagTrigger) UpdateTriggerUsage ¶ added in v0.4.0
func (ft *FlagTrigger) UpdateTriggerUsage() error
type Segment ¶
type Segment struct {
*featureproto.Segment
}
func (*Segment) AddClause ¶
func (s *Segment) AddClause(ruleID string, clause *featureproto.Clause) error
func (*Segment) AddClauseValue ¶
func (*Segment) AddIncludedUserCount ¶
func (*Segment) ChangeClauseAttribute ¶
func (*Segment) ChangeClauseOperator ¶
func (s *Segment) ChangeClauseOperator(ruleID string, clauseID string, operator featureproto.Clause_Operator) error
func (*Segment) ChangeDescription ¶
func (*Segment) ChangeName ¶
func (*Segment) DeleteRule ¶
func (*Segment) RemoveClauseValue ¶
func (*Segment) RemoveIncludedUserCount ¶
func (*Segment) SetDeleted ¶
func (*Segment) SetIncludedUserCount ¶
func (*Segment) SetStatus ¶
func (s *Segment) SetStatus(status featureproto.Segment_Status)
func (*Segment) UpdateSegment ¶ added in v1.2.0
func (s *Segment) UpdateSegment( name *wrapperspb.StringValue, description *wrapperspb.StringValue, ) (*Segment, error)
type SegmentUser ¶
type SegmentUser struct {
*featureproto.SegmentUser
}
func NewSegmentUser ¶
func NewSegmentUser(segmentID string, userID string, state featureproto.SegmentUser_State, deleted bool) *SegmentUser