Documentation
¶
Overview ¶
Package growthbook provides an OpenFeature provider implementation for the GrowthBook feature flagging system.
Index ¶
- type Provider
- func (p *Provider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, ...) openfeature.BoolResolutionDetail
- func (p *Provider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, ...) openfeature.FloatResolutionDetail
- func (p *Provider) GetClient() *gb.Client
- func (p *Provider) Hooks() []openfeature.Hook
- func (p *Provider) Init(evalCtx openfeature.EvaluationContext) error
- func (p *Provider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, ...) openfeature.IntResolutionDetail
- func (p *Provider) Metadata() openfeature.Metadata
- func (p *Provider) ObjectEvaluation(ctx context.Context, flag string, defaultValue interface{}, ...) openfeature.InterfaceResolutionDetail
- func (p *Provider) Shutdown()
- func (p *Provider) Status() openfeature.State
- func (p *Provider) StringEvaluation(ctx context.Context, flag string, defaultValue string, ...) openfeature.StringResolutionDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the OpenFeature provider interface for GrowthBook.
func NewProvider ¶
NewProvider creates a new instance of the GrowthBook OpenFeature provider. You can specify optional parameters:
- timeout: Time to wait for feature loading during initialization (default: 30s)
- usesDataSource: Whether the client uses a built-in data source that requires loading
func (*Provider) BooleanEvaluation ¶
func (p *Provider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, evalCtx openfeature.FlattenedContext) openfeature.BoolResolutionDetail
BooleanEvaluation evaluates a boolean feature flag.
func (*Provider) FloatEvaluation ¶
func (p *Provider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, evalCtx openfeature.FlattenedContext) openfeature.FloatResolutionDetail
FloatEvaluation evaluates a float feature flag.
func (*Provider) Hooks ¶
func (p *Provider) Hooks() []openfeature.Hook
Hooks returns any hooks the provider wishes to register.
func (*Provider) Init ¶
func (p *Provider) Init(evalCtx openfeature.EvaluationContext) error
Init initializes the provider
func (*Provider) IntEvaluation ¶
func (p *Provider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, evalCtx openfeature.FlattenedContext) openfeature.IntResolutionDetail
IntEvaluation evaluates an integer feature flag.
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, flag string, defaultValue interface{}, evalCtx openfeature.FlattenedContext) openfeature.InterfaceResolutionDetail
ObjectEvaluation evaluates an object feature flag.
func (*Provider) Shutdown ¶
func (p *Provider) Shutdown()
Shutdown cleans up any resources used by the provider
func (*Provider) Status ¶
func (p *Provider) Status() openfeature.State
Status returns the current provider status
func (*Provider) StringEvaluation ¶
func (p *Provider) StringEvaluation(ctx context.Context, flag string, defaultValue string, evalCtx openfeature.FlattenedContext) openfeature.StringResolutionDetail
StringEvaluation evaluates a string feature flag.