features

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package features contains example feature definitions for the component architecture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLegacyBehaviorFeature

func NewLegacyBehaviorFeature(version string) feature.Mutation[*resources.DeploymentResourceMutator]

NewLegacyBehaviorFeature creates a Feature Mutation for older versions (< 8.0.0). It demonstrates how Feature Mutations are used to apply legacy behavior for backwards compatibility, such as adding deprecated configuration or reverting modern defaults to legacy values.

func NewLegacyCompatibilityFeature

func NewLegacyCompatibilityFeature(version string) feature.Mutation[*resources.DeploymentResourceMutator]

NewLegacyCompatibilityFeature creates a Feature Mutation enabled for versions < 9.0.0. This demonstrates the use of Feature Mutations for backward compatibility, adding legacy flags and removing modern settings using the restricted mutator.

func NewTracingFeature

func NewTracingFeature(version string, enabled bool) feature.Mutation[*resources.DeploymentResourceMutator]

NewTracingFeature creates a Feature Mutation that is enabled for versions >= 8.1.0, and only if the boolean flag is true. It demonstrates how to use Additional boolean gating with the When() method on the ResourceFeature to combine semver with other feature toggles.

Types

type ExampleVersionConstraint

type ExampleVersionConstraint struct {
	// contains filtered or unexported fields
}

ExampleVersionConstraint is a simple implementation of feature.VersionConstraint for the component-architecture example. It uses semantic versioning to determine if a feature is enabled.

func MustRegister

func MustRegister(name, constraint string) *ExampleVersionConstraint

MustRegister is a convenience function that panics if the constraint is invalid.

func NewExampleVersionConstraint

func NewExampleVersionConstraint(name, constraint string) (*ExampleVersionConstraint, error)

NewExampleVersionConstraint creates a new ExampleVersionConstraint from a semver constraint string.

func (*ExampleVersionConstraint) Enabled

func (c *ExampleVersionConstraint) Enabled(version string) (bool, error)

Enabled reports whether the feature is enabled for the given version string.

Jump to

Keyboard shortcuts

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