this is experimental repo!!!
This version of SDK has been tested with Go 1.14
go get github.com/simpleflags/golang-server-sdk
First we need to import lib
import sdk "github.com/simpleflags/golang-server-sdk"
Next we initialize client instance for interaction with api
err := sdk.Initialize(sdkKey)
Target definition can be user, device, app etc.
target := map[string]interface{}{
"identifier": "enver",
}
Evaluating Feature Flag
showFeature, err := sdk.Evaluate(featureFlagKey, &target).Bool(false)
Flush any changes and close the SDK
sdk.close()
very simple and small interfaces:
type Client interface {
WaitForInitialization()
Evaluate(feature string, target evaluation.Target) evaluation.Evaluation
Close() error
}
type Logger interface {
Debug(args ...interface{})
Debugf(template string, args ...interface{})
Info(args ...interface{})
Infof(template string, args ...interface{})
Error(args ...interface{})
Errorf(template string, args ...interface{})
}
It is very simple to set logger from your current app configuration:
sdk.SetLogger(your_logger)