engine

package
v0.0.0-...-59e7d7e Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2016 License: BSD-2-Clause Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// GetFeatureFlags returns list of features or an empty list otherwise.
	GetFeatureFlags() ([]FeatureFlag, error)
	// GetFeatureFlag returns an specific feature or engine.NotFoundError when it's not found.
	GetFeatureFlag(FeatureFlagKey) (*FeatureFlag, error)
	// UpsertFeatureFlag updates or inserts the feature flag.
	UpsertFeatureFlag(FeatureFlag) error
	// DeleteFeatureFlag deletes an specific feature flag or returns engine.NotFoundError when it's not found.
	DeleteFeatureFlag(FeatureFlagKey) error
}

Storage interface.

type FeatureFlag

type FeatureFlag struct {
	Enabled    bool    `json:"enabled"`
	Key        string  `json:"key"`
	Users      []*User `json:"users,omitempty"`
	Percentage uint32  `json:"percentage"`
}

func NewFeatureFlag

func NewFeatureFlag(key string, enabled bool, users []*User, percentage uint32) (*FeatureFlag, error)

func (*FeatureFlag) ContainsUser

func (ff *FeatureFlag) ContainsUser(user *User) bool

func (*FeatureFlag) UserInPercentage

func (ff *FeatureFlag) UserInPercentage(user *User) bool

type FeatureFlagKey

type FeatureFlagKey struct {
	Key string
}

type NotFoundError

type NotFoundError struct {
	Message string
}

func (*NotFoundError) Error

func (n *NotFoundError) Error() string

type User

type User struct {
	Id string `json:"id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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