featureflag

package
v0.0.0-...-bc49051 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RolloutEnabledZero = 0.0
	RolloutEnabledFull = 1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagConfig

type FlagConfig struct {
	Name       string        `yaml:"name"`
	Parameters []string      `yaml:"parameters"`
	Rollout    []RolloutRule `yaml:"rollout"`
}

type Flags

type Flags struct {
	// contains filtered or unexported fields
}

Flags holds all the flag rules for a given context.

func (*Flags) Enabled

func (f *Flags) Enabled(name string, p Parameters) bool

Enabled returns if a flag is "enabled" for a given set of optional parameters.

Enabled is safe to call from multiple threads.

type Parameters

type Parameters map[string]string

Parameters are arguments to Enabled calls for specific contexts.

type Predicate

type Predicate struct {
	Parameter string   `yaml:"parameter"`
	In        []string `yaml:"in"`
}

Predicate is a rollout rule logical filter.

type RolloutRule

type RolloutRule struct {
	// Match filters the parameters the flag applies to.
	Match Predicate `yaml:"match"`
	// EnabledRatio is the fraction of parameters to
	// randomly and consistently select for the flag
	// to be enabled for. It should be on the
	// interval [0.0,1.0].
	EnabledRatio float64 `yaml:"enabled_ratio"`
}

RolloutRule is a specific cohort to enable the flag for according to some split percentage.

Jump to

Keyboard shortcuts

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