ff

package module
v0.0.0-...-0f9a95d Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 6 Imported by: 0

README

ff

Go Report Card Documentation GitHub issues license

Tiny feature flag framework in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeatureFlag

type FeatureFlag struct {
	ID    string
	Value float64
}

FeatureFlag represents a feature flag with an identifier and a value

func NewFeatureFlag

func NewFeatureFlag(id string, value float64) (*FeatureFlag, error)

NewFeatureFlag returns a new feature flag

func (*FeatureFlag) IsEnabled

func (ff *FeatureFlag) IsEnabled() bool

IsEnabled returns true with probability equal to the value of the flag.

func (*FeatureFlag) IsEnabledForUser

func (ff *FeatureFlag) IsEnabledForUser(userID string) bool

IsEnabledForUser returns true if the treatment represented by this flag should be applied for a given user identifier. If the flag's value does not change, this will always return the same result for any given user identifier.

type FlagStorage

type FlagStorage interface {
	GetFlag(id string) (*FeatureFlag, error)
	PutFlag(ff *FeatureFlag) error
	DeleteFlag(id string) error
}

FlagStorage represents the required functionality of a storage solution for feature flags.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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