features

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FeatureTypeDynamic = iota
	FeatureTypeManual
	FeatureTypeCommunity
)

Constants for the different feature types.

Variables

This section is empty.

Functions

func SetTemplater

func SetTemplater(templFnc func(io.Writer, string, interface{}) error)

SetTemplater sets the templater that is used for emails

Types

type ChangeableFeatureValue

type ChangeableFeatureValue struct {
	Provider    string
	FeatureName string
	Value       ChangeableValue
}

ChangeableFeatureValue associates a ChangeableValue with a FeatureName and Provider

type ChangeableFeatureValueS

type ChangeableFeatureValueS []*ChangeableFeatureValue

ChangeableFeatureValueS is a slice of ChangeableFeatureValues

func (ChangeableFeatureValueS) ClearDirt

func (c ChangeableFeatureValueS) ClearDirt()

ClearDirt clears the dirty bool

func (ChangeableFeatureValueS) FindByFeatureAndProvider

func (c ChangeableFeatureValueS) FindByFeatureAndProvider(featureName, provider string) (*ChangeableFeatureValue, bool)

FindByFeatureAndProvider finds the first ChangeableFeatureValue in this slice with the given feature name and provider

func (ChangeableFeatureValueS) FindByFeatureName

func (c ChangeableFeatureValueS) FindByFeatureName(featureName string) (f ChangeableFeatureValueS)

FindByFeatureName finds all ChangeableFeatureValues in this slice with the given featureName

func (ChangeableFeatureValueS) FindByProvider

func (c ChangeableFeatureValueS) FindByProvider(provider string) (f ChangeableFeatureValueS)

FindByProvider finds all ChangeableFeatureValues in this slice with the given provider

func (ChangeableFeatureValueS) FindChanged

FindChanged finds all ChangeableFeatureValues that have changed

func (ChangeableFeatureValueS) GetFeaturesString

func (c ChangeableFeatureValueS) GetFeaturesString() string

GetFeaturesString returns a string presentation (json array) of all feature names in this slice

func (ChangeableFeatureValueS) GetProviderString

func (c ChangeableFeatureValueS) GetProviderString() string

GetProviderString returns a string presentation (json array) of all providers in this slice

func (ChangeableFeatureValueS) ToHTMLTable

func (c ChangeableFeatureValueS) ToHTMLTable() (string, error)

ToHTMLTable returns a html table representation (for email notifications)

func (ChangeableFeatureValueS) ToTextTable

func (c ChangeableFeatureValueS) ToTextTable() (string, error)

ToTextTable returns a ascii table representation (for email notifications)

type ChangeableValue

type ChangeableValue struct {
	Init    interface{}
	Last    interface{}
	Current interface{}
	Dirty   bool
}

ChangeableValue holds a value that can change multiple times. It holds the initial value, the last value and the current one.

func (*ChangeableValue) Changed

func (v *ChangeableValue) Changed() bool

Changed checks if the value changed from last to current

type FeatChecker

type FeatChecker = func(featureName string, c *provider.ClientConfig) interface{}

FeatChecker is a function that checks a given feature and returns its value.

type Feature

type Feature struct {
	Name              string
	Type              uint8
	Colorisation      uint8
	Check             FeatChecker          `json:"-"`
	GetValue          featValueGetter      `json:"-"`
	Documentation     FeatureDocumentation `json:"-"`
	CommunityObserver *observer.Observer   `json:"-"`
}

Feature describes an orpheus feature. An orpheus feature can be of different types (dynamic, community, manual) and can vary in complexity.

func (*Feature) MarshalBinary

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

MarshalBinary marshals Feature into bytes.

func (*Feature) UnmarshalBinary

func (f *Feature) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into Feature.

func (Feature) WebName

func (f Feature) WebName() string

WebName returns a representation of the feature name for the web

type FeatureDocumentation

type FeatureDocumentation struct {
	Synopsis          string             `yaml:"synop"`
	Description       string             `yaml:"desc"`
	ValueExplanations []ValueExplanation `yaml:"values"`
	RelatedFeatures   []string           `yaml:"related_features"`
	RelevantStandards SpecStandards      `yaml:"standards"`
}

FeatureDocumentation represents the documentation of a feature.

func (FeatureDocumentation) Check

func (fd FeatureDocumentation) Check(loadedFeatures []Feature, featureName string) (ok bool)

Check checks if a FeatureDocumentation is ok. Check asserts that a synopsis and description is provided and that all provided RelatedFeatures are loaded. Check also warns if no ValueExplanations are provided.

type FeatureStructure

type FeatureStructure struct {
	Features        []HeadedFeature
	NumberDynamic   uint
	NumberCommunity uint
	NumberManual    uint
}

FeatureStructure holds a structure of Features.

func (*FeatureStructure) Add

func (fs *FeatureStructure) Add(hf HeadedFeature)

Add adds a HeadedFeature to the FeatureStructure

type FeatureValue

type FeatureValue struct {
	Feature     Feature
	Value       interface{}
	LastChecked time.Time // Only needed for community features
}

FeatureValue associates a Feature with a value.

func (*FeatureValue) MarshalBinary

func (f *FeatureValue) MarshalBinary() ([]byte, error)

MarshalBinary marshals FeatureValue into bytes.

func (*FeatureValue) UnmarshalBinary

func (f *FeatureValue) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into FeatureValue.

func (*FeatureValue) Update

func (f *FeatureValue) Update(value interface{})

Update updates the value of a FeatureValue to the given value and updates the time when it was updated.

type FeatureValues

type FeatureValues []*FeatureValue

FeatureValues is a slice of *FeatureValue.

func (FeatureValues) Find

func (fs FeatureValues) Find(featureName string) (*FeatureValue, bool)

Find returns a FeatureValue from a list of FeatureValue and a bool indicating if a value was found.

func (FeatureValues) MarshalBinary

func (fs FeatureValues) MarshalBinary() ([]byte, error)

MarshalBinary marshals FeatureValues into bytes.

func (*FeatureValues) UnmarshalBinary

func (fs *FeatureValues) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into FeatureValues.

type HeadedFeature

type HeadedFeature struct {
	Heading  string    `json:"heading"`
	Features []Feature `json:"features"`
}

HeadedFeature is a list of features with a heading.

type SpecStandard

type SpecStandard struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

SpecStandard holds information about a specification standard.

type SpecStandards

type SpecStandards []SpecStandard

SpecStandards is a slice of SpecStandard

func (SpecStandards) Names

func (ss SpecStandards) Names() (names []string)

Names returns a slice of the Names of these SpecStandards

type ValueExplanation

type ValueExplanation struct {
	Value       string `yaml:"value"`
	Explanation string `yaml:"explanation"`
}

ValueExplanation describes a value.

Jump to

Keyboard shortcuts

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