models

package
v0.0.0-...-a8f7221 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeatureFlag

type FeatureFlag struct {
	// The key of a feature flag
	Key string `json:"key"`
	// Tell if a feature flag is enabled. If set to false,
	// the feature flag can still be partially enabled thanks to
	// the Users, Groups and Percentage properties
	Enabled bool `json:"enabled"`
	// Gives access to a feature to specific user IDs
	Users []uint32 `json:"users"`
	// Gives access to a feature to specific groups
	Groups []string `json:"groups"`
	// Gives access to a feature to a percentage of users
	Percentage uint32 `json:"percentage"`
}

Represents a feature flag

func (FeatureFlag) GroupHasAccess

func (f FeatureFlag) GroupHasAccess(group string) bool

Check if a group has access to a feature

func (FeatureFlag) IsEnabled

func (f FeatureFlag) IsEnabled() bool

Check if a feature flag is enabled

func (FeatureFlag) IsPartiallyEnabled

func (f FeatureFlag) IsPartiallyEnabled() bool

Check if a feature flag is partially enabled

func (FeatureFlag) UserHasAccess

func (f FeatureFlag) UserHasAccess(user uint32) bool

Check if a user has access to a feature

func (FeatureFlag) Validate

func (f FeatureFlag) Validate() error

Self validate the properties of a feature flag

type FeatureFlags

type FeatureFlags []FeatureFlag

Jump to

Keyboard shortcuts

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