model

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(s string) uint32

Hash is taking a string and convert.

Types

type DiffCache

type DiffCache struct {
	Deleted map[string]Flag        `json:"deleted"`
	Added   map[string]Flag        `json:"added"`
	Updated map[string]DiffUpdated `json:"updated"`
}

DiffCache contains the changes made in the cache, to be able to notify the user that something has changed (logs, webhook ...)

func (DiffCache) HasDiff

func (d DiffCache) HasDiff() bool

HasDiff check if we have differences

type DiffUpdated

type DiffUpdated struct {
	Before Flag `json:"old_value"`
	After  Flag `json:"new_value"`
}

type Flag

type Flag struct {
	Disable    bool        `json:"disable,omitempty"`
	Rule       string      `json:"rule,omitempty"`
	Percentage float64     `json:"percentage,omitempty"`
	True       interface{} `json:"true,omitempty"`    // Value if Rule applied, and in percentage
	False      interface{} `json:"false,omitempty"`   // Value if Rule applied and not in percentage
	Default    interface{} `json:"default,omitempty"` // Value if Rule does not applied
}

Flag describe the fields of a flag.

func (Flag) String

func (f Flag) String() string

string display correctly a flag

func (*Flag) Value

func (f *Flag) Value(flagName string, user ffuser.User) (interface{}, VariationType)

Value is returning the Value associate to the flag (True / False / Default ) based if the toggle apply to the user or not.

type VariationType added in v0.10.0

type VariationType string

VariationType enum which describe the decision taken

const (
	VariationTrue       VariationType = "True"
	VariationFalse      VariationType = "False"
	VariationDefault    VariationType = "Default"
	VariationSDKDefault VariationType = "SdkDefault"
)

Jump to

Keyboard shortcuts

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