Help us shape the future of Go! Take the 2026 Go Developer Survey

bucketeer

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

Bucketeer Server-side SDK for Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserID = newDefaultUserID()

Functions

func New

func New(ctx context.Context, userID string, attrs map[string]string) context.Context

func NewDefault

func NewDefault(ctx context.Context) context.Context

Types

type APIKey

type APIKey string // APIKey is bucketeer API key.

type Client

type Client interface {
	// BoolVariation fetches variation whose type is boolean using specified feature ID.
	// Default value is used when an error occurs.  A tracker can be used to track metrics which associates with the variation.
	BoolVariation(ctx context.Context, featureID string, def bool) (bool, Tracker)

	// Int64Variation fetches variation whose type is int64 using specified feature ID.
	// Default value is used when an error occurs.  A tracker can be used to track metrics which associates with the variation.
	Int64Variation(ctx context.Context, featureID string, def int64) (int64, Tracker)

	// Float64Variation fetches variation whose type is float64 using specified feature ID.
	// Default value is used when an error occurs.  A tracker can be used to track metrics which associates with the variation.
	Float64Variation(ctx context.Context, featureID string, def float64) (float64, Tracker)

	// StringVariation fetches variation whose type is string using specified feature ID.
	// Default value is used when an error occurs.  A tracker can be used to track metrics which associates with the variation.
	StringVariation(ctx context.Context, featureID string, def string) (string, Tracker)

	// JSONVariation fetches variation using specified feature ID and marshals to destination.
	// A tracker can be used to track metrics which associates with the variation.
	JSONVariation(ctx context.Context, featureID string, dst interface{}) Tracker

	Close()
}

Client is bucketeer API client.

func NewClient

func NewClient(ctx context.Context, cfg *Config) (Client, error)

type Config

type Config struct {
	Log                func(error)   // Log is a function which is called when the function is not nil and an error occurs.
	Host               Host          // Host is bucketeer api host name.
	APIKey             APIKey        // APIKey is bucketeer api key.
	Tag                Tag           // Tag is specified in fetching variations.
	EventFlushInterval time.Duration // EventFlushInterval is an interval to flush events. Default: 1s
	EventBufferSize    int           // EventBufferSize is a buffer size of events channel as queue. Default: 65536
}

Config is a configuration of bucketeer client.

type Error

type Error struct {
	UserID         string
	UserAttributes map[string]string
	FeatureID      string
	Message        string
	Goal           *event.GoalEvent
	Evaluation     *event.EvaluationEvent
	Retryable      bool
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Host

type Host string

type Tag

type Tag string // Tag is feature's tag.

type Tracker

type Tracker interface {
	Track(goalID string, value float64)
}

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

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