openfeature

package module
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 19 Imported by: 0

README

helix.go - OpenFeature integration

Website Go API reference Go Report Card GitHub Release

The OpenFeature integration provides an opinionated way to interact with feature flags for helix services. It uses the OpenFeature specification and the GO Feature Flag provider.

Documentation

Overview

Package openfeature exposes an opinionated way to interact with OpenFeature using the GO Feature Flag provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// Paths are the file paths containing the GO Feature Flag strategies.
	//
	// Required.
	Paths []string `json:"paths"`
}

Config is used to configure the OpenFeature integration.

type OpenFeature

type OpenFeature interface {
	EvaluateString(ctx context.Context, flag string, defaultValue string, target string) (openfeature.StringEvaluationDetails, error)
	EvaluateBoolean(ctx context.Context, flag string, defaultValue bool, target string) (openfeature.BooleanEvaluationDetails, error)
	EvaluateInteger(ctx context.Context, flag string, defaultValue int64, target string) (openfeature.IntEvaluationDetails, error)
	EvaluateFloat(ctx context.Context, flag string, defaultValue float64, target string) (openfeature.FloatEvaluationDetails, error)
}

OpenFeature exposes an opinionated way to interact with the OpenFeature specification and GO Feature Flag provider, by bringing automatic distributed tracing as well as error recording within traces.

func Init

func Init(cfg Config) (OpenFeature, error)

Init tries to create an OpenFeature client with the GO Feature Flag provider given the Config. Returns an error if Config is not valid or if the initialization failed.

Jump to

Keyboard shortcuts

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