Versions in this module Expand all Collapse all v0 v0.2.0 Jun 11, 2026 Changes in this version + var ErrGradualNonBoolean = errors.New("gradual rollout is boolean-only; use variant rollout for multi-value flags") + var ErrInvalidVariantWeights = errors.New("variant weights must sum to 100") + var ErrMissingRollout = errors.New("targeting rule references unknown rollout") + var ErrMissingRolloutKey = errors.New("rollout requires stable user key (kind+key or user_id)") + var ErrMissingSegment = errors.New("targeting rule references unknown segment") + var ErrMissingVariation = errors.New("targeting rule references unknown variation") + var ErrPercentageNonBoolean = errors.New(...) + func CoerceBool(v any) (bool, error) + func CoerceFloat64(v any) (float64, error) + func CoerceString(v any) (string, error) + func HashPercent(input string) int + func InRollout(key string, percentage float64) bool + func MatchAll(rules []Condition, attrs map[string]any) bool + func StableHash(s string) uint32 + func StringHash(s string) uint32 + func VariantForKey(key string, variants []string) string + type Condition struct + Attribute string + Operator Operator + Value any + func (c Condition) Match(attrs map[string]any) bool + type Evaluator struct + func NewEvaluator() *Evaluator + func NewEvaluatorWithLogger(logger *slog.Logger) *Evaluator + func (e *Evaluator) Evaluate(config *FlagConfig, flatCtx map[string]any) (any, error) + type FlagConfig struct + DefaultValue any + IsActive bool + Key string + OffVariationID *string + Rollouts map[string]*Rollout + SegmentsByID map[string]*Segment + TargetingRules []TargetingRule + Type FlagType + Variations []Variation + VariationsByID map[string]Variation + func (fc *FlagConfig) HydrateVariations() + type FlagType string + const FlagTypeBoolean + const FlagTypeJSON + const FlagTypeNumber + const FlagTypeString + type LogicalOperator string + const LogicalAND + const LogicalNOT + const LogicalOR + type Operator string + const OpContains + const OpEndsWith + const OpEquals + const OpExists + const OpGreaterThan + const OpIn + const OpLessThan + const OpNin + const OpNotContains + const OpNotEquals + const OpNotExists + const OpStartsWith + type Rollout struct + ID string + Increment float64 + IntervalHours float64 + Percentage float64 + Salt string + StartAt *time.Time + Strategy RolloutKind + TargetPercentage float64 + Variants []VariantWeight + type RolloutKind string + const RolloutGradual + const RolloutOff + const RolloutPercentage + const RolloutVariant + type Segment struct + Force bool + ID string + LogicalOp LogicalOperator + Rules []Condition + type TargetingRule struct + Conditions []Condition + ID string + Kind string + LogicalOp LogicalOperator + OrderIndex int + RolloutID *string + SegmentID string + VariationID *string + type VariantWeight struct + VariationID string + Weight float64 + type Variation struct + ID string + Value any v0.1.0 Jun 5, 2026