experimental

package
v3.25.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFeatures

func AllFeatures(ctx context.Context) map[string]bool

AllFeatures returns all features and their values. The values come from the registry in the context, the global registry, or the default value.

func DisableFeatures

func DisableFeatures(features ...string)

DisableFeatures disables the given features on the global registry.

func EnableFeatures

func EnableFeatures(features ...string)

EnableFeatures enables the given features on the global registry.

func NewContextWithRegistry

func NewContextWithRegistry(parent context.Context, r *Registry) context.Context

NewContextWithRegistry returns a new context derived from the parent, that contains the given feature registry.

Types

type Config

type Config struct {
	Features []string `name:"features" description:"Experimental features to activate"`
}

Config is the configuration for experimental features.

type Feature

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

Feature is an experimental feature that can be enabled or disabled.

func DefineFeature

func DefineFeature(name string, defaultValue bool) *Feature

DefineFeature defines an experimental feature.

func (*Feature) GetValue

func (f *Feature) GetValue(ctx context.Context) bool

GetValue gets the value of the feature flag. The value comes from the registry in the context, the global registry, or the default value.

type Registry

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

Registry is a registry of enabled experimental features.

func NewRegistry

func NewRegistry(enabledFeatures ...string) *Registry

NewRegistry returns a new feature registry with the given features enabled.

func (*Registry) DisableFeatures

func (r *Registry) DisableFeatures(features ...string)

DisableFeatures disables the given features.

func (*Registry) EnableFeatures

func (r *Registry) EnableFeatures(features ...string)

EnableFeatures enables the given features.

Jump to

Keyboard shortcuts

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