feature

package
v0.0.0-...-85cd7ee Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx map[string]interface{}) (Context, *GeneralError)

Types

type Context

type Context interface {
	ffcontext.Context
	Hash(key string) string
}

type ConvertErrorCode

type ConvertErrorCode string
const (
	GENERAL             ConvertErrorCode = "GENERAL"
	INVALIDCONTEXT      ConvertErrorCode = "INVALID_CONTEXT"
	PARSEERROR          ConvertErrorCode = "PARSE_ERROR"
	TARGETINGKEYMISSING ConvertErrorCode = "TARGETING_KEY_MISSING"
)

func (ConvertErrorCode) String

func (c ConvertErrorCode) String() string

type Feature

type Feature interface {
	Provider() *ffclient.GoFeatureFlag
	Shutdown() error
	Reset() error
	AppendOrUpdateRule(ctx context.Context, key string, rule *Rule) error
}

type Flag

type Flag struct {
	Variations      map[string]interface{}  `yaml:"variations,omitempty"`
	Rules           []*Rule                 `yaml:"targeting,omitempty"`
	DefaultRule     *Rule                   `yaml:"defaultRule,omitempty"`
	Experimentation interface{}             `yaml:"experimentation,omitempty"`
	Scheduled       interface{}             `yaml:"scheduledRollout,omitempty"`
	TrackEvents     *bool                   `yaml:"trackEvents,omitempty"`
	Disable         *bool                   `yaml:"disable,omitempty"`
	Version         *string                 `yaml:"version,omitempty"`
	Metadata        *map[string]interface{} `yaml:"metadata,omitempty"`
}

func (*Flag) AppendOrUpdateRule

func (f *Flag) AppendOrUpdateRule(rule *Rule) error

func (*Flag) FindRule

func (f *Flag) FindRule(name string) *Rule

type FlagState

type FlagState struct {
	Value         interface{}
	Timestamp     int64
	VariationType string
	TrackEvents   bool
	Failed        bool
	ErrorCode     string
	Reason        string
	Metadata      map[string]interface{}
}

type Flags

type Flags map[string]*Flag

type GeneralError

type GeneralError struct {
	ErrorCode    string `json:"errorCode"`
	ErrorDetails string `json:"errorDetails"`
	Key          string `json:"key,omitempty"`
}

func IsGeneralError

func IsGeneralError(err error) *GeneralError

func NewGeneralError

func NewGeneralError(errorCode interface{}, errorDetails string, keys ...string) *GeneralError

func (*GeneralError) Error

func (e *GeneralError) Error() string

func (*GeneralError) ToJSON

func (e *GeneralError) ToJSON() string

type ProgressiveRollout

type ProgressiveRollout struct {
	Initial *ProgressiveRolloutStep `yaml:"initial,omitempty"`
	End     *ProgressiveRolloutStep `yaml:"end,omitempty"`
}

type ProgressiveRolloutStep

type ProgressiveRolloutStep struct {
	Variation  *string    `yaml:"variation,omitempty"`
	Percentage *float64   `yaml:"percentage,omitempty"`
	Date       *time.Time `yaml:"date,omitempty"`
}

type Rule

type Rule struct {
	Name               string              `yaml:"name,omitempty"`
	Query              string              `yaml:"query,omitempty"`
	VariationResult    string              `yaml:"variation,omitempty"`
	Percentages        map[string]float64  `yaml:"percentage,omitempty"`
	ProgressiveRollout *ProgressiveRollout `yaml:"progressiveRollout,omitempty"`
	Disable            *bool               `yaml:"disable,omitempty"`
}

func (*Rule) AppendValidate

func (r *Rule) AppendValidate() error

func (*Rule) Validate

func (r *Rule) Validate() error

type UpdateRetriever

type UpdateRetriever interface {
	CanUpdate(ctx context.Context) bool
	AppendOrUpdateRule(ctx context.Context, key string, rule *Rule) error
}

type Updater

type Updater interface {
	AppendOrUpdateRule(ctx context.Context, updateRetrievers []UpdateRetriever, key string, rule *Rule) error
}

func NewUpdater

func NewUpdater() Updater

Jump to

Keyboard shortcuts

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