featuregate

package
v1.0.0-beta.230 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextResolver

func ContextResolver() contextResolver

func NewMiddleware

func NewMiddleware[Request any, Response any](getNamespace func(ctx context.Context) (string, bool), checker *FeatureGateChecker) operation.Middleware[Request, Response]

Types

type FeatureFlag

type FeatureFlag string
const (
	CtxKeyCredits FeatureFlag = "om_ff_credits_enabled"
)

func (FeatureFlag) String

func (f FeatureFlag) String() string

type FeatureGateChecker

type FeatureGateChecker struct {
	Gate  Gate
	Flags Flags
	// FlagOverrides is used to handle config level feature setups
	// ex. if a feature is disabled on config level, then we are not going to call the feature gate
	FlagOverrides map[FeatureFlag]bool
	// contains filtered or unexported fields
}

func NewFeatureGateChecker

func NewFeatureGateChecker(gate Gate, flags Flags, flagOverrides map[FeatureFlag]bool) *FeatureGateChecker

func (*FeatureGateChecker) Enabled

func (h *FeatureGateChecker) Enabled(ns string, flag string) (bool, error)

func (*FeatureGateChecker) Validate

func (h *FeatureGateChecker) Validate() error

type Flags

type Flags map[FeatureFlag]string

func (*Flags) Credits

func (f *Flags) Credits() string

func (*Flags) Keys

func (f *Flags) Keys() []FeatureFlag

func (*Flags) Validate

func (f *Flags) Validate() error

type Gate

type Gate interface {
	EvaluateBool(namespace, flag string, defaultValue bool) (bool, error)
}

func NewNoop

func NewNoop() Gate

type Noop

type Noop struct{}

func (Noop) EvaluateBool

func (n Noop) EvaluateBool(string, string, bool) (bool, error)

Jump to

Keyboard shortcuts

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