featureflag

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled added in v0.40.1

func Enabled(key, userID string) bool

func Init added in v0.40.1

func Init(conf Config, log logrus.FieldLogger) error

Init will initialize global client with a launch darkly client

func SetGlobalClient added in v0.40.1

func SetGlobalClient(client Client)

func Variation added in v0.40.1

func Variation(key, defaultVal, userID string) string

Types

type Client

type Client interface {
	Enabled(key, userID string) bool
	EnabledUser(key string, user ld.User) bool

	Variation(key, defaultVal, userID string) string
	VariationUser(key string, defaultVal string, user ld.User) string

	AllEnabledFlags(key string) []string
}

func GetGlobalClient added in v0.40.1

func GetGlobalClient() Client

func NewClient

func NewClient(cfg *Config, logger logrus.FieldLogger) (Client, error)

type Config

type Config struct {
	Key            string
	RequestTimeout time.Duration `mapstructure:"request_timeout" split_words:"true" default:"5s"`
	Enabled        bool          `default:"false"`
	// contains filtered or unexported fields
}

type MockClient

type MockClient struct {
	BoolVars   map[string]bool
	StringVars map[string]string
}

func (MockClient) AllEnabledFlags added in v0.45.0

func (c MockClient) AllEnabledFlags(string) []string

func (MockClient) Enabled

func (c MockClient) Enabled(key, userID string) bool

func (MockClient) EnabledUser added in v0.42.0

func (c MockClient) EnabledUser(key string, _ ld.User) bool

func (MockClient) Variation

func (c MockClient) Variation(key string, defaultVal string, userID string) string

func (MockClient) VariationUser added in v0.42.0

func (c MockClient) VariationUser(key string, defaultVal string, _ ld.User) string

Jump to

Keyboard shortcuts

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