eppoclient

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package eppoclient provides client for eppo.cloud. Check InitClient to get started.

Index

Constants

View Source
const MAX_CACHE_ENTRIES = 1000 // arbitrary; the caching library requires a max limit
View Source
const RAC_ENDPOINT = "/randomized_assignment/v3/config"
View Source
const REQUEST_TIMEOUT_SECONDS = time.Duration(10 * time.Second)

Variables

This section is empty.

Functions

func ToFloat64 added in v2.1.1

func ToFloat64(val interface{}) (float64, error)

ToFloat64 attempts to convert an interface{} value to a float64. It supports inputs of type float64 or string (which can be parsed as float64). Returns a float64 and nil error on success, or 0 and an error on failure.

Types

type Allocation

type Allocation struct {
	PercentExposure float32     `json:"percentExposure"`
	Variations      []Variation `json:"variations"`
}

type AssignmentEvent

type AssignmentEvent struct {
	Experiment        string     `json:"experiment"`
	FeatureFlag       string     `json:"featureFlag"`
	Allocation        string     `json:"allocation"`
	Variation         Value      `json:"variation"`
	Subject           string     `json:"subject"`
	Timestamp         string     `json:"timestamp"`
	SubjectAttributes dictionary `json:"subjectAttributes,omitempty"`
}

type AssignmentLogger

type AssignmentLogger struct {
}

func (*AssignmentLogger) LogAssignment

func (al *AssignmentLogger) LogAssignment(event AssignmentEvent)

type Config

type Config struct {
	BaseUrl          string
	ApiKey           string
	AssignmentLogger IAssignmentLogger
}

type EppoClient

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

Client for eppo.cloud. Instance of this struct will be created on calling InitClient. EppoClient will then immediately start polling experiments data from Eppo.

func InitClient

func InitClient(config Config) *EppoClient

InitClient is required to start polling of experiments configurations and create an instance of EppoClient, which could be used to get assignments information.

func (*EppoClient) GetAssignment added in v2.0.1

func (ec *EppoClient) GetAssignment(subjectKey string, flagKey string, subjectAttributes dictionary) (string, error)

GetAssignment is maintained for backwards capability. It will return a string value for the assignment.

func (*EppoClient) GetBoolAssignment

func (ec *EppoClient) GetBoolAssignment(subjectKey string, flagKey string, subjectAttributes dictionary) (bool, error)

func (*EppoClient) GetJSONStringAssignment added in v2.0.1

func (ec *EppoClient) GetJSONStringAssignment(subjectKey string, flagKey string, subjectAttributes dictionary) (string, error)

func (*EppoClient) GetNumericAssignment

func (ec *EppoClient) GetNumericAssignment(subjectKey string, flagKey string, subjectAttributes dictionary) (float64, error)

func (*EppoClient) GetStringAssignment

func (ec *EppoClient) GetStringAssignment(subjectKey string, flagKey string, subjectAttributes dictionary) (string, error)

type IAssignmentLogger

type IAssignmentLogger interface {
	LogAssignment(event AssignmentEvent)
}

func NewAssignmentLogger

func NewAssignmentLogger() IAssignmentLogger

type SDKParams

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

type Value

type Value struct {
	ValueType    ValueType `json:"valueType"`
	BoolValue    bool      `json:"boolValue,omitempty"`
	NumericValue float64   `json:"numericValue,omitempty"`
	StringValue  string    `json:"stringValue,omitempty"`
}

func Bool

func Bool(value bool) Value

func Null

func Null() Value

func Numeric

func Numeric(value float64) Value

func String

func String(value string) Value

func (Value) GetBoolValue added in v2.0.1

func (v Value) GetBoolValue() bool

func (Value) GetNumericValue added in v2.0.1

func (v Value) GetNumericValue() float64

func (Value) GetStringValue added in v2.0.1

func (v Value) GetStringValue() string

func (Value) MarshalJSON added in v2.0.1

func (v Value) MarshalJSON() ([]byte, error)

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(data []byte) error

type ValueType

type ValueType int
const (
	NullType    ValueType = iota
	BoolType    ValueType = iota
	NumericType ValueType = iota
	StringType  ValueType = iota
)

type Variation

type Variation struct {
	Name       string     `json:"name"`
	Value      Value      `json:"typedValue"`
	ShardRange shardRange `json:"shardRange"`
}

Jump to

Keyboard shortcuts

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