launchdarkly

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LDClient added in v0.1.5

type LDClient interface {
	BoolVariationDetail(key string, context ldcontext.Context, defaultVal bool) (bool, ldreason.EvaluationDetail, error)
	IntVariationDetail(key string, context ldcontext.Context, defaultVal int) (int, ldreason.EvaluationDetail, error)
	Float64VariationDetail(key string, context ldcontext.Context, defaultVal float64) (float64, ldreason.EvaluationDetail, error)
	StringVariationDetail(key string, context ldcontext.Context, defaultVal string) (string, ldreason.EvaluationDetail, error)
	JSONVariationDetail(key string, context ldcontext.Context, defaultVal ldvalue.Value) (ldvalue.Value, ldreason.EvaluationDetail, error)
}

LDClient is the narrowed local interface for the parts of the `*ld.LDClient` LaunchDarkly client used by the provider.

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Error(msg string, args ...any)
	Warn(msg string, args ...any)
}

Logger defines a minimal interface for the provider's logger.

type NoOpLogger

type NoOpLogger struct{}

func (*NoOpLogger) Debug

func (l *NoOpLogger) Debug(msg string, args ...any)

func (*NoOpLogger) Error

func (l *NoOpLogger) Error(msg string, args ...any)

func (*NoOpLogger) Info

func (l *NoOpLogger) Info(msg string, args ...any)

func (*NoOpLogger) Warn

func (l *NoOpLogger) Warn(msg string, args ...any)

type Option

type Option func(*options)

func WithKindAttr

func WithKindAttr(name string) Option

WithKindAttr sets the name of the LaunchDarkly Context kind attribute to recognize. By default, "kind" is used.

func WithLogger

func WithLogger(l Logger) Option

WithLogger sets a logger implementation. By default a noop logger is used.

type Provider

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

Provider implements the FeatureProvider interface for LaunchDarkly.

func NewProvider

func NewProvider(ldclient LDClient, opts ...Option) *Provider

NewProvider creates a new LaunchDarkly OpenFeature Provider instance.

func (*Provider) BooleanEvaluation

func (p *Provider) BooleanEvaluation(ctx context.Context, flagKey string, defaultValue bool, evalCtx openfeature.FlattenedContext) openfeature.BoolResolutionDetail

func (*Provider) FloatEvaluation

func (p *Provider) FloatEvaluation(ctx context.Context, flagKey string, defaultValue float64, evalCtx openfeature.FlattenedContext) openfeature.FloatResolutionDetail

FloatEvaluation evaluates a float feature flag and returns the result.

func (*Provider) Hooks

func (p *Provider) Hooks() []openfeature.Hook

Hooks returns any hooks implemented by the provider. Not supported by LaunchDarkly.

func (*Provider) IntEvaluation

func (p *Provider) IntEvaluation(ctx context.Context, flagKey string, defaultValue int64, evalCtx openfeature.FlattenedContext) openfeature.IntResolutionDetail

IntEvaluation evaluates an integer feature flag and returns the result.

func (*Provider) Metadata

func (p *Provider) Metadata() openfeature.Metadata

Metadata returns metadata about the provider.

func (*Provider) ObjectEvaluation

func (p *Provider) ObjectEvaluation(ctx context.Context, flagKey string, defaultValue any, evalCtx openfeature.FlattenedContext) openfeature.InterfaceResolutionDetail

ObjectEvaluation evaluates an object feature flag and returns the result.

func (*Provider) StringEvaluation

func (p *Provider) StringEvaluation(ctx context.Context, flagKey string, defaultValue string, evalCtx openfeature.FlattenedContext) openfeature.StringResolutionDetail

StringEvaluation evaluates a string feature flag and returns the result.

Jump to

Keyboard shortcuts

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