Categorygithub.com/simpleflags/golang-server-sdk
modulepackage
0.2.1
Repository: https://github.com/simpleflags/golang-server-sdk.git
Documentation: pkg.go.dev

# README

Simple Flags Server-side SDK for Go


this is experimental repo!!!

Supported GO versions

This version of SDK has been tested with Go 1.14

Install

go get github.com/simpleflags/golang-server-sdk

Usage

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()

Interface

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{})
}

Logger

It is very simple to set logger from your current app configuration:

sdk.SetLogger(your_logger)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetLogger sets the default logger to be used by this package.
No description provided by the author