models

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KVsToFeatureMap

func KVsToFeatureMap(kvb stores.KVBytes) (*models.FeatureMap, error)

KVsToFeatures helper for unmarshalling consul result sets into Features

Types

type Feature

type Feature struct {
	FeatureType FeatureType `json:"feature_type"`
	Key         string      `json:"key"`
	Namespace   string      `json:"namespace"`
	Scope       string      `json:"scope"`
	Value       interface{} `json:"value"`
	Comment     string      `json:"comment"`
	UpdatedBy   string      `json:"updated_by"`
}

Feature KV model for feature flags

func NewFeature

func NewFeature(name string, value interface{}, comment string, user string, scope string, ns string) (f *Feature)

NewFeature init a Feature

func (*Feature) BoolValue

func (f *Feature) BoolValue() bool

BoolValue cast Value to bool

func (*Feature) FloatValue

func (f *Feature) FloatValue() float64

FloatValue cast Value to float64

func (*Feature) GetNamespace

func (f *Feature) GetNamespace() string

GetNamespace formats the fully scoped namespace

func (*Feature) GetScope

func (f *Feature) GetScope() string

func (*Feature) ScopedKey

func (f *Feature) ScopedKey() string

ScopedKey expanded key with namespace and scope

func (*Feature) ToJSON

func (f *Feature) ToJSON() ([]byte, error)

ToJSON marshal feature to json

type FeatureType

type FeatureType string

FeatureType accepted feature types

const (
	Percentile   FeatureType = "percentile"
	Boolean      FeatureType = "boolean"
	Invalid      FeatureType = "invalid"
	DefaultScope             = "default"
	FeatureScope             = "features"
)

func ParseValueAndFeatureType

func ParseValueAndFeatureType(v string) (interface{}, FeatureType)

GetFeatureTypeFromValue interface to type helper

type Features

type Features []Feature

Features a Feature result set

func (Features) Len

func (a Features) Len() int

func (Features) Less

func (a Features) Less(i, j int) bool

func (Features) Swap

func (a Features) Swap(i, j int)

type Info

type Info struct {
	// CurrentSha the current SHA1 from the audit repository.
	CurrentSha string `json:"current_sha"`
}

Info container struct for CurrentSha

Jump to

Keyboard shortcuts

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