statsig

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: ISC Imports: 7 Imported by: 3

README

Statsig Go Server SDK

build-and-test

The Statsig Go SDK for multi-user, server side environments. If you need a SDK for another language or single user client environment, check out our other SDKs.

Statsig helps you move faster with Feature Gates (Feature Flags) and Dynamic Configs. It also allows you to run A/B tests to validate your new features and understand their impact on your KPIs. If you're new to Statsig, create an account at statsig.com.

Getting Started

Check out our SDK docs to get started.

Testing

Each server SDK is tested at multiple levels - from unit to integration and e2e tests. Our internal e2e test harness runs daily against each server SDK, while unit and integration tests can be seen in the respective github repos of each SDK. The statsig_test.go runs a validation test on local rule/condition evaluation for this SDK against the results in the statsig backend.

Guidelines

Documentation

Overview

Package statsig implements feature gating and a/b testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGate

func CheckGate(user types.StatsigUser, gate string) bool

Checks the value of a Feature Gate for the given user

func GetConfig

func GetConfig(user types.StatsigUser, config string) types.DynamicConfig

Gets the DynamicConfig value for the given user

func GetExperiment

func GetExperiment(user types.StatsigUser, experiment string) types.DynamicConfig

Gets the DynamicConfig value of an Experiment for the given user

func Initialize

func Initialize(sdkKey string)

Initializes the global Statsig instance with the given sdkKey

func InitializeWithOptions

func InitializeWithOptions(sdkKey string, options *types.StatsigOptions)

Initializes the global Statsig instance with the given sdkKey and options

func LogEvent

func LogEvent(event types.StatsigEvent)

Logs an event to the Statsig console

func Shutdown

func Shutdown()

Cleans up Statsig, persisting any Event Logs and cleanup processes Using any method is undefined after Shutdown() has been called

func WrapperSDK added in v0.2.1

func WrapperSDK(sdkKey string, options *types.StatsigOptions, sdkName string, sdkVersion string)

Types

type Client

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

An instance of a StatsigClient for interfacing with Statsig Feature Gates, Dynamic Configs, Experiments, and Event Logging

func New

func New(sdkKey string) *Client

Initializes a Statsig Client with the given sdkKey

func NewWithOptions

func NewWithOptions(sdkKey string, options *types.StatsigOptions) *Client

Initializes a Statsig Client with the given sdkKey and options

func WrapperSDKInstance added in v0.2.1

func WrapperSDKInstance(sdkKey string, options *types.StatsigOptions, sdkName string, sdkVersion string) *Client

func (*Client) CheckGate

func (c *Client) CheckGate(user types.StatsigUser, gate string) bool

Checks the value of a Feature Gate for the given user

func (*Client) GetConfig

func (c *Client) GetConfig(user types.StatsigUser, config string) types.DynamicConfig

Gets the DynamicConfig value for the given user

func (*Client) GetExperiment

func (c *Client) GetExperiment(user types.StatsigUser, experiment string) types.DynamicConfig

Gets the DynamicConfig value of an Experiment for the given user

func (*Client) LogEvent

func (c *Client) LogEvent(event types.StatsigEvent)

Logs an event to Statsig for analysis in the Statsig Console

func (*Client) Shutdown

func (c *Client) Shutdown()

Cleans up Statsig, persisting any Event Logs and cleanup processes Using any method is undefined after Shutdown() has been called

Directories

Path Synopsis
internal
net

Jump to

Keyboard shortcuts

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