flagstate

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllFlags

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

AllFlags is a snapshot of the state of multiple feature flags with regard to a specific user. This is the return type of ffclient.AllFlagsState(). Serializing this object to JSON MarshalJSON() will produce a JSON you can sent to your front-end.

func NewAllFlags

func NewAllFlags() AllFlags

NewAllFlags will create a new AllFlags for a specific user. It sets valid to true, because until we have an error everything is valid.

func (*AllFlags) AddFlag

func (a *AllFlags) AddFlag(flagKey string, state FlagState)

AddFlag is adding a flag in the list for the specific user.

func (*AllFlags) GetFlags

func (a *AllFlags) GetFlags() map[string]FlagState

func (*AllFlags) IsValid

func (a *AllFlags) IsValid() bool

IsValid is a getter to know if the AllFlags object is valid.

func (AllFlags) MarshalJSON

func (a AllFlags) MarshalJSON() ([]byte, error)

MarshalJSON is serializing the object to JSON, it will produce a JSON you can sent to your front-end.

type FlagState

type FlagState struct {
	Value         interface{}            `json:"value"`
	Timestamp     int64                  `json:"timestamp"`
	VariationType string                 `json:"variationType"`
	TrackEvents   bool                   `json:"trackEvents"`
	Failed        bool                   `json:"-"`
	ErrorCode     flag.ErrorCode         `json:"errorCode"`
	Reason        flag.ResolutionReason  `json:"reason"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

FlagState represents the state of an individual feature flag, with regard to a specific user, when it was called.

Jump to

Keyboard shortcuts

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