configcatpreevaluate

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 7 Imported by: 0

README

ConfigCat pre-evaluate

This Go package provides a simple way to pre-evaluate your feature flags when using ConfigCat. It transforms your config_v5.json file into one that is stripped of all the rules and only contains the values for the flags.

Usage


import "github.com/filiptronicek/configcat-pre-evaluate"

func main() {
    // Read the config_v5.json file
    config, err := ioutil.ReadFile("config_v5.json")
    if err != nil {
        panic(err)
    }

    // Pre-evaluate the config
    preEvaluatedConfig, err := configcat.PreEvaluateJson(config)
    if err != nil {
        panic(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRolloutEvaluator added in v0.3.0

func NewRolloutEvaluator(logger Logger) *rolloutEvaluator

Types

type FeatureFlagConfig

type FeatureFlagConfig struct {
	Properties map[string]interface{} `json:"p"`
	Features   map[string]interface{} `json:"f"`
}

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})

	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Warnln(args ...interface{})
	Errorln(args ...interface{})
}

Logger defines the interface this library logs with.

func DefaultLogger

func DefaultLogger() Logger

DefaultLogger creates the default logger (logrus.New()).

type User

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

User is an object containing attributes to properly identify a given user for rollout evaluation.

func NewUser

func NewUser(identifier string) *User

NewUser creates a new user object. The identifier argument is mandatory.

func NewUserWithAdditionalAttributes

func NewUserWithAdditionalAttributes(identifier string, email string, country string, custom map[string]string) *User

NewUserWithAdditionalAttributes creates a new user object with additional attributes. The identifier argument is mandatory.

func (*User) GetAttribute

func (user *User) GetAttribute(key string) string

GetAttribute retrieves a user attribute identified by a key.

Jump to

Keyboard shortcuts

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