Documentation ¶
Overview ¶
Package fflag defines the standard interface for feature flags.
Index ¶
- type MockProvider
- func (m *MockProvider) Bool(ctx context.Context, flag string, def bool, data interface{}) (bool, error)
- func (m *MockProvider) Float64(ctx context.Context, flag string, def float64, data interface{}) (float64, error)
- func (m *MockProvider) Int(ctx context.Context, flag string, def int, data interface{}) (int, error)
- func (m *MockProvider) String(ctx context.Context, flag string, def string, data interface{}) (string, error)
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockProvider ¶
type MockProvider struct { BoolFunc func(context.Context, string, bool, interface{}) (bool, error) StringFunc func(context.Context, string, string, interface{}) (string, error) IntFunc func(context.Context, string, int, interface{}) (int, error) Float64Func func(context.Context, string, float64, interface{}) (float64, error) }
MockProvider is a test mock for the Provider interface.
type Provider ¶
type Provider interface { // Bool returns a boolean for the specified flag, using data to evaluate the // variation to use. This data value is implementation-specific. If the // context is cancelled, the operation stops and returns an error along with // the default value. Bool(ctx context.Context, flag string, defaultVal bool, data interface{}) (bool, error) // String returns a string for the specified flag, using data to evaluate the // variation to use. This data value is implementation-specific. If the // context is cancelled, the operation stops and returns an error along with // the default value. String(ctx context.Context, flag string, defaultVal string, data interface{}) (string, error) // Int returns an integer for the specified flag, using data to evaluate the // variation to use. This data value is implementation-specific. If the // context is cancelled, the operation stops and returns an error along with // the default value. Int(ctx context.Context, flag string, defaultVal int, data interface{}) (int, error) // Float64 returns a float for the specified flag, using data to evaluate the // variation to use. This data value is implementation-specific. If the // context is cancelled, the operation stops and returns an error along with // the default value. Float64(ctx context.Context, flag string, defaultVal float64, data interface{}) (float64, error) }
Provider defines the methods that provide feature flag variations.
Click to show internal directories.
Click to hide internal directories.