Help us shape the future of Go! Take the 2026 Go Developer Survey

feature

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package feature defines the feature flag and feature toggle contracts for gorp framework.

Index

Constants

View Source
const FeatureKey = "framework.feature"

FeatureKey is the container key for the feature flag manager capability.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvaluationContext

type EvaluationContext struct {
	UserID   string         `json:"user_id,omitempty"`
	TenantID string         `json:"tenant_id,omitempty"`
	Groups   []string       `json:"groups,omitempty"`
	Attrs    map[string]any `json:"attrs,omitempty"`
}

EvaluationContext contains contextual metadata used for feature flag evaluation.

type FeatureManager

type FeatureManager interface {
	// EvaluateBool evaluates a boolean feature flag.
	EvaluateBool(ctx context.Context, flagKey string, defaultVal bool, evalCtx EvaluationContext) bool

	// EvaluateString evaluates a string feature flag.
	EvaluateString(ctx context.Context, flagKey string, defaultVal string, evalCtx EvaluationContext) string

	// EvaluateInt evaluates an integer feature flag.
	EvaluateInt(ctx context.Context, flagKey string, defaultVal int, evalCtx EvaluationContext) int

	// EvaluateJSON evaluates a JSON object feature flag into the target out interface.
	EvaluateJSON(ctx context.Context, flagKey string, out any, evalCtx EvaluationContext) error
}

FeatureManager defines the contract for evaluating dynamic feature flags and canary rollouts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL