openfeature

package module
v2.0.0-...-929d4c5 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package openfeature provides global access to the OpenFeature API.

Index

Examples

Constants

View Source
const (
	// DefaultReason - the resolved value was configured statically, or otherwise fell back to a pre-configured value.
	DefaultReason Reason = "DEFAULT"
	// TargetingMatchReason - the resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting.
	TargetingMatchReason Reason = "TARGETING_MATCH"
	// SplitReason - the resolved value was the result of pseudorandom assignment.
	SplitReason Reason = "SPLIT"
	// DisabledReason - the resolved value was the result of the flag being disabled in the management system.
	DisabledReason Reason = "DISABLED"
	// StaticReason - the resolved value is static (no dynamic evaluation)
	StaticReason Reason = "STATIC"
	// CachedReason - the resolved value was retrieved from cache
	CachedReason Reason = "CACHED"
	// UnknownReason - the reason for the resolved value could not be determined.
	UnknownReason Reason = "UNKNOWN"
	// ErrorReason - the resolved value was the result of an error.
	ErrorReason Reason = "ERROR"

	TargetingKey string = "targetingKey" // evaluation context map key. The targeting key uniquely identifies the subject (end-user, or client service) of a flag evaluation.
)

Variables

This section is empty.

Functions

func AddHooks

func AddHooks(hooks ...Hook)

AddHooks appends to the collection of any previously added hooks

func SetEvaluationContext

func SetEvaluationContext(evalCtx EvaluationContext)

SetEvaluationContext sets the global evaluation context.

func SetLogger

func SetLogger(l logr.Logger)

SetLogger sets the global logger.

func SetProvider

func SetProvider(provider FeatureProvider)

SetProvider sets the global provider.

Types

type BoolResolutionDetail

type BoolResolutionDetail struct {
	Value bool
	ProviderResolutionDetail
}

BoolResolutionDetail provides a resolution detail with boolean type

type BooleanEvaluationDetails

type BooleanEvaluationDetails struct {
	Value bool
	EvaluationDetails
}

type Client

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

Client implements the behaviour required of an openfeature client

func NewClient

func NewClient(name string) *Client

NewClient returns a new Client. Name is a unique identifier for this client

Example
client := openfeature.NewClient("example-client")
fmt.Printf("Client Name: %s", client.Metadata().Name())
Output:

Client Name: example-client

func (*Client) AddHooks

func (c *Client) AddHooks(hooks ...Hook)

AddHooks appends to the client's collection of any previously added hooks

func (*Client) BooleanValue

func (c *Client) BooleanValue(ctx context.Context, flag string, defaultValue bool, evalCtx EvaluationContext, options ...Option) (bool, error)

BooleanValue performs a flag evaluation that returns a boolean.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

Example
client := openfeature.NewClient("example-client")
value, err := client.BooleanValue(
	context.Background(), "test-flag", true, openfeature.EvaluationContext{},
)
if err != nil {
	log.Fatal("error while getting boolean value : ", err)
}

fmt.Printf("test-flag value: %v", value)
Output:

test-flag value: true

func (*Client) BooleanValueDetails

func (c *Client) BooleanValueDetails(ctx context.Context, flag string, defaultValue bool, evalCtx EvaluationContext, options ...Option) (BooleanEvaluationDetails, error)

BooleanValueDetails performs a flag evaluation that returns an evaluation details struct.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

func (*Client) EvaluationContext

func (c *Client) EvaluationContext() EvaluationContext

EvaluationContext returns the client's evaluation context

func (*Client) FloatValue

func (c *Client) FloatValue(ctx context.Context, flag string, defaultValue float64, evalCtx EvaluationContext, options ...Option) (float64, error)

FloatValue performs a flag evaluation that returns a float64.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

Example
client := openfeature.NewClient("example-client")
value, err := client.FloatValue(
	context.Background(), "test-flag", 0.55, openfeature.EvaluationContext{},
)
if err != nil {
	log.Fatalf("error while getting float value: %v", err)
}

fmt.Printf("test-flag value: %v", value)
Output:

test-flag value: 0.55

func (*Client) FloatValueDetails

func (c *Client) FloatValueDetails(ctx context.Context, flag string, defaultValue float64, evalCtx EvaluationContext, options ...Option) (FloatEvaluationDetails, error)

FloatValueDetails performs a flag evaluation that returns an evaluation details struct.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

func (*Client) IntValue

func (c *Client) IntValue(ctx context.Context, flag string, defaultValue int64, evalCtx EvaluationContext, options ...Option) (int64, error)

IntValue performs a flag evaluation that returns an int64.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

Example
client := openfeature.NewClient("example-client")
value, err := client.IntValue(
	context.Background(), "test-flag", 3, openfeature.EvaluationContext{},
)
if err != nil {
	log.Fatalf("error while getting int value: %v", err)
}

fmt.Printf("test-flag value: %v", value)
Output:

test-flag value: 3

func (*Client) IntValueDetails

func (c *Client) IntValueDetails(ctx context.Context, flag string, defaultValue int64, evalCtx EvaluationContext, options ...Option) (IntEvaluationDetails, error)

IntValueDetails performs a flag evaluation that returns an evaluation details struct.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

func (*Client) Metadata

func (c *Client) Metadata() ClientMetadata

Metadata returns the client's metadata

func (*Client) ObjectValue

func (c *Client) ObjectValue(ctx context.Context, flag string, defaultValue interface{}, evalCtx EvaluationContext, options ...Option) (interface{}, error)

ObjectValue performs a flag evaluation that returns an object.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

Example
client := openfeature.NewClient("example-client")
value, err := client.ObjectValue(
	context.Background(), "test-flag", map[string]string{"foo": "bar"}, openfeature.EvaluationContext{},
)
if err != nil {
	log.Fatal("error while getting object value : ", err)
}

str, _ := json.Marshal(value)
fmt.Printf("test-flag value: %v", string(str))
Output:

test-flag value: {"foo":"bar"}

func (*Client) ObjectValueDetails

func (c *Client) ObjectValueDetails(ctx context.Context, flag string, defaultValue interface{}, evalCtx EvaluationContext, options ...Option) (InterfaceEvaluationDetails, error)

ObjectValueDetails performs a flag evaluation that returns an evaluation details struct.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

func (*Client) SetEvaluationContext

func (c *Client) SetEvaluationContext(evalCtx EvaluationContext)

SetEvaluationContext sets the client's evaluation context

func (*Client) StringValue

func (c *Client) StringValue(ctx context.Context, flag string, defaultValue string, evalCtx EvaluationContext, options ...Option) (string, error)

StringValue performs a flag evaluation that returns a string.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

Example
client := openfeature.NewClient("example-client")
value, err := client.StringValue(
	context.Background(), "test-flag", "openfeature", openfeature.EvaluationContext{},
)
if err != nil {
	log.Fatal("error while getting string value : ", err)
}

fmt.Printf("test-flag value: %v", value)
Output:

test-flag value: openfeature

func (*Client) StringValueDetails

func (c *Client) StringValueDetails(ctx context.Context, flag string, defaultValue string, evalCtx EvaluationContext, options ...Option) (StringEvaluationDetails, error)

StringValueDetails performs a flag evaluation that returns an evaluation details struct.

Parameters: - ctx is the standard go context struct used to manage requests (e.g. timeouts) - flag is the key that uniquely identifies a particular flag - defaultValue is returned if an error occurs - evalCtx is the evaluation context used in a flag evaluation (not to be confused with ctx) - options are optional additional evaluation options e.g. WithHooks & WithHookHints

func (*Client) WithLogger

func (c *Client) WithLogger(l logr.Logger) *Client

WithLogger sets the logger of the client

type ClientMetadata

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

ClientMetadata provides a client's metadata

func NewClientMetadata

func NewClientMetadata(name string) ClientMetadata

NewClientMetadata constructs ClientMetadata Allows for simplified hook test cases while maintaining immutability

func (ClientMetadata) Name

func (cm ClientMetadata) Name() string

Name returns the client's name

type ErrorCode

type ErrorCode string
const (
	// ProviderNotReadyCode - the value was resolved before the provider was ready.
	ProviderNotReadyCode ErrorCode = "PROVIDER_NOT_READY"
	// FlagNotFoundCode - the flag could not be found.
	FlagNotFoundCode ErrorCode = "FLAG_NOT_FOUND"
	// ParseErrorCode - an error was encountered parsing data, such as a flag configuration.
	ParseErrorCode ErrorCode = "PARSE_ERROR"
	// TypeMismatchCode - the type of the flag value does not match the expected type.
	TypeMismatchCode ErrorCode = "TYPE_MISMATCH"
	// TargetingKeyMissingCode - the provider requires a targeting key and one was not provided in the evaluation context.
	TargetingKeyMissingCode ErrorCode = "TARGETING_KEY_MISSING"
	// InvalidContextCode - the evaluation context does not meet provider requirements.
	InvalidContextCode ErrorCode = "INVALID_CONTEXT"
	// GeneralCode - the error was for a reason not enumerated above.
	GeneralCode ErrorCode = "GENERAL"
)

type EvaluationContext

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

EvaluationContext provides ambient information for the purposes of flag evaluation The use of the constructor, NewEvaluationContext, is enforced to set EvaluationContext's fields in order to enforce immutability. https://github.com/open-feature/spec/blob/main/specification/evaluation-context/evaluation-context.md

func NewEvaluationContext

func NewEvaluationContext(targetingKey string, attributes map[string]interface{}) EvaluationContext

NewEvaluationContext constructs an EvaluationContext

targetingKey - uniquely identifying the subject (end-user, or client service) of a flag evaluation attributes - contextual data used in flag evaluation

func (EvaluationContext) Attribute

func (e EvaluationContext) Attribute(key string) interface{}

Attribute retrieves the attribute with the given key

func (EvaluationContext) Attributes

func (e EvaluationContext) Attributes() map[string]interface{}

Attributes returns a copy of the EvaluationContext's attributes

func (EvaluationContext) TargetingKey

func (e EvaluationContext) TargetingKey() string

TargetingKey returns the key uniquely identifying the subject (end-user, or client service) of a flag evaluation

type EvaluationDetails

type EvaluationDetails struct {
	FlagKey  string
	FlagType Type
	ResolutionDetail
}

type EvaluationOptions

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

EvaluationOptions should contain a list of hooks to be executed for a flag evaluation

func (EvaluationOptions) HookHints

func (e EvaluationOptions) HookHints() HookHints

HookHints returns evaluation options' hook hints

func (EvaluationOptions) Hooks

func (e EvaluationOptions) Hooks() []Hook

Hooks returns evaluation options' hooks

type FeatureProvider

type FeatureProvider interface {
	Metadata() Metadata
	BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, evalCtx FlattenedContext) BoolResolutionDetail
	StringEvaluation(ctx context.Context, flag string, defaultValue string, evalCtx FlattenedContext) StringResolutionDetail
	FloatEvaluation(ctx context.Context, flag string, defaultValue float64, evalCtx FlattenedContext) FloatResolutionDetail
	IntEvaluation(ctx context.Context, flag string, defaultValue int64, evalCtx FlattenedContext) IntResolutionDetail
	ObjectEvaluation(ctx context.Context, flag string, defaultValue interface{}, evalCtx FlattenedContext) InterfaceResolutionDetail
	Hooks() []Hook
}

FeatureProvider interface defines a set of functions that can be called in order to evaluate a flag. vendors should implement

type FlattenedContext

type FlattenedContext map[string]interface{}

FlattenedContext contains metadata for a given flag evaluation in a flattened structure. TargetingKey ("targetingKey") is stored as a string value if provided in the evaluation context.

type FloatEvaluationDetails

type FloatEvaluationDetails struct {
	Value float64
	EvaluationDetails
}

type FloatResolutionDetail

type FloatResolutionDetail struct {
	Value float64
	ProviderResolutionDetail
}

FloatResolutionDetail provides a resolution detail with float64 type

type Hook

type Hook interface {
	Before(hookContext HookContext, hookHints HookHints) (*EvaluationContext, error)
	After(hookContext HookContext, flagEvaluationDetails InterfaceEvaluationDetails, hookHints HookHints) error
	Error(hookContext HookContext, err error, hookHints HookHints)
	Finally(hookContext HookContext, hookHints HookHints)
}

Hook allows application developers to add arbitrary behavior to the flag evaluation lifecycle. They operate similarly to middleware in many web frameworks. https://github.com/open-feature/spec/blob/main/specification/hooks.md

type HookContext

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

HookContext defines the base level fields of a hook context

func NewHookContext

func NewHookContext(
	flagKey string,
	flagType Type,
	defaultValue interface{},
	clientMetadata ClientMetadata,
	providerMetadata Metadata,
	evaluationContext EvaluationContext,
) HookContext

NewHookContext constructs HookContext Allows for simplified hook test cases while maintaining immutability

func (HookContext) ClientMetadata

func (h HookContext) ClientMetadata() ClientMetadata

ClientMetadata returns the client's metadata

func (HookContext) DefaultValue

func (h HookContext) DefaultValue() interface{}

DefaultValue returns the hook context's default value

func (HookContext) EvaluationContext

func (h HookContext) EvaluationContext() EvaluationContext

EvaluationContext returns the hook context's EvaluationContext

func (HookContext) FlagKey

func (h HookContext) FlagKey() string

FlagKey returns the hook context's flag key

func (HookContext) FlagType

func (h HookContext) FlagType() Type

FlagType returns the hook context's flag type

func (HookContext) ProviderMetadata

func (h HookContext) ProviderMetadata() Metadata

ProviderMetadata returns the provider's metadata

type HookHints

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

HookHints contains a map of hints for hooks

func NewHookHints

func NewHookHints(mapOfHints map[string]interface{}) HookHints

NewHookHints constructs HookHints

func (HookHints) Value

func (h HookHints) Value(key string) interface{}

Value returns the value at the given key in the underlying map. Maintains immutability of the map.

type IClient

type IClient interface {
	Metadata() ClientMetadata
	AddHooks(hooks ...Hook)
	SetEvaluationContext(evalCtx EvaluationContext)
	EvaluationContext() EvaluationContext
	BooleanValue(ctx context.Context, flag string, defaultValue bool, evalCtx EvaluationContext, options ...Option) (bool, error)
	StringValue(ctx context.Context, flag string, defaultValue string, evalCtx EvaluationContext, options ...Option) (string, error)
	FloatValue(ctx context.Context, flag string, defaultValue float64, evalCtx EvaluationContext, options ...Option) (float64, error)
	IntValue(ctx context.Context, flag string, defaultValue int64, evalCtx EvaluationContext, options ...Option) (int64, error)
	ObjectValue(ctx context.Context, flag string, defaultValue interface{}, evalCtx EvaluationContext, options ...Option) (interface{}, error)
	BooleanValueDetails(ctx context.Context, flag string, defaultValue bool, evalCtx EvaluationContext, options ...Option) (BooleanEvaluationDetails, error)
	StringValueDetails(ctx context.Context, flag string, defaultValue string, evalCtx EvaluationContext, options ...Option) (StringEvaluationDetails, error)
	FloatValueDetails(ctx context.Context, flag string, defaultValue float64, evalCtx EvaluationContext, options ...Option) (FloatEvaluationDetails, error)
	IntValueDetails(ctx context.Context, flag string, defaultValue int64, evalCtx EvaluationContext, options ...Option) (IntEvaluationDetails, error)
	ObjectValueDetails(ctx context.Context, flag string, defaultValue interface{}, evalCtx EvaluationContext, options ...Option) (InterfaceEvaluationDetails, error)
}

IClient defines the behaviour required of an openfeature client

type IntEvaluationDetails

type IntEvaluationDetails struct {
	Value int64
	EvaluationDetails
}

type IntResolutionDetail

type IntResolutionDetail struct {
	Value int64
	ProviderResolutionDetail
}

IntResolutionDetail provides a resolution detail with int64 type

type InterfaceEvaluationDetails

type InterfaceEvaluationDetails struct {
	Value interface{}
	EvaluationDetails
}

type InterfaceResolutionDetail

type InterfaceResolutionDetail struct {
	Value interface{}
	ProviderResolutionDetail
}

InterfaceResolutionDetail provides a resolution detail with interface{} type

type Metadata

type Metadata struct {
	Name string
}

Metadata provides provider name

func ProviderMetadata

func ProviderMetadata() Metadata

ProviderMetadata returns the global provider's metadata

type NoopProvider

type NoopProvider struct{}

NoopProvider implements the FeatureProvider interface and provides functions for evaluating flags

func (NoopProvider) BooleanEvaluation

func (e NoopProvider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, evalCtx FlattenedContext) BoolResolutionDetail

BooleanEvaluation returns a boolean flag.

func (NoopProvider) FloatEvaluation

func (e NoopProvider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, evalCtx FlattenedContext) FloatResolutionDetail

FloatEvaluation returns a float flag.

func (NoopProvider) Hooks

func (e NoopProvider) Hooks() []Hook

Hooks returns hooks

func (NoopProvider) IntEvaluation

func (e NoopProvider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, evalCtx FlattenedContext) IntResolutionDetail

IntEvaluation returns an int flag.

func (NoopProvider) Metadata

func (e NoopProvider) Metadata() Metadata

Metadata returns the metadata of the provider

func (NoopProvider) ObjectEvaluation

func (e NoopProvider) ObjectEvaluation(ctx context.Context, flag string, defaultValue interface{}, evalCtx FlattenedContext) InterfaceResolutionDetail

ObjectEvaluation returns an object flag

func (NoopProvider) StringEvaluation

func (e NoopProvider) StringEvaluation(ctx context.Context, flag string, defaultValue string, evalCtx FlattenedContext) StringResolutionDetail

StringEvaluation returns a string flag.

type Option

type Option func(*EvaluationOptions)

Option applies a change to EvaluationOptions

func WithHookHints

func WithHookHints(hookHints HookHints) Option

WithHookHints applies provided hook hints.

func WithHooks

func WithHooks(hooks ...Hook) Option

WithHooks applies provided hooks.

type ProviderResolutionDetail

type ProviderResolutionDetail struct {
	ResolutionError ResolutionError
	Reason          Reason
	Variant         string
}

ProviderResolutionDetail is a structure which contains a subset of the fields defined in the EvaluationDetail, representing the result of the provider's flag resolution process see https://github.com/open-feature/spec/blob/main/specification/types.md#resolution-details N.B we could use generics but to support older versions of go for now we will have type specific resolution detail

func (ProviderResolutionDetail) Error

func (p ProviderResolutionDetail) Error() error

func (ProviderResolutionDetail) ResolutionDetail

func (p ProviderResolutionDetail) ResolutionDetail() ResolutionDetail

type Reason

type Reason string

Reason indicates the semantic reason for a returned flag value

type ResolutionDetail

type ResolutionDetail struct {
	Variant      string
	Reason       Reason
	ErrorCode    ErrorCode
	ErrorMessage string
}

type ResolutionError

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

ResolutionError is an enumerated error code with an optional message

func NewFlagNotFoundResolutionError

func NewFlagNotFoundResolutionError(msg string) ResolutionError

NewFlagNotFoundResolutionError constructs a resolution error with code FLAG_NOT_FOUND

Explanation - The flag could not be found.

func NewGeneralResolutionError

func NewGeneralResolutionError(msg string) ResolutionError

NewGeneralResolutionError constructs a resolution error with code GENERAL

Explanation - The error was for a reason not enumerated above.

func NewInvalidContextResolutionError

func NewInvalidContextResolutionError(msg string) ResolutionError

NewInvalidContextResolutionError constructs a resolution error with code INVALID_CONTEXT

Explanation - The evaluation context does not meet provider requirements.

func NewParseErrorResolutionError

func NewParseErrorResolutionError(msg string) ResolutionError

NewParseErrorResolutionError constructs a resolution error with code PARSE_ERROR

Explanation - An error was encountered parsing data, such as a flag configuration.

func NewProviderNotReadyResolutionError

func NewProviderNotReadyResolutionError(msg string) ResolutionError

NewProviderNotReadyResolutionError constructs a resolution error with code PROVIDER_NOT_READY

Explanation - The value was resolved before the provider was ready.

func NewTargetingKeyMissingResolutionError

func NewTargetingKeyMissingResolutionError(msg string) ResolutionError

NewTargetingKeyMissingResolutionError constructs a resolution error with code TARGETING_KEY_MISSING

Explanation - The provider requires a targeting key and one was not provided in the evaluation context.

func NewTypeMismatchResolutionError

func NewTypeMismatchResolutionError(msg string) ResolutionError

NewTypeMismatchResolutionError constructs a resolution error with code TYPE_MISMATCH

Explanation - The type of the flag value does not match the expected type.

func (ResolutionError) Error

func (r ResolutionError) Error() string

type StringEvaluationDetails

type StringEvaluationDetails struct {
	Value string
	EvaluationDetails
}

type StringResolutionDetail

type StringResolutionDetail struct {
	Value string
	ProviderResolutionDetail
}

StringResolutionDetail provides a resolution detail with string type

type Type

type Type int64

Type represents the type of a flag

const (
	Boolean Type = iota
	String
	Float
	Int
	Object
)

func (Type) String

func (t Type) String() string

type UnimplementedHook

type UnimplementedHook struct{}

UnimplementedHook implements all hook methods with empty functions Include UnimplementedHook in your hook struct to avoid defining empty functions e.g.

type MyHook struct {
  UnimplementedHook
}

func (UnimplementedHook) After

func (u UnimplementedHook) After(hookContext HookContext, flagEvaluationDetails InterfaceEvaluationDetails, hookHints HookHints) error

func (UnimplementedHook) Before

func (u UnimplementedHook) Before(hookContext HookContext, hookHints HookHints) (*EvaluationContext, error)

func (UnimplementedHook) Error

func (u UnimplementedHook) Error(hookContext HookContext, err error, hookHints HookHints)

func (UnimplementedHook) Finally

func (u UnimplementedHook) Finally(hookContext HookContext, hookHints HookHints)

Jump to

Keyboard shortcuts

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