star

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FeatureConstructor   starlark.String = "feature"
	FeatureVariableName  string          = "result"
	DefaultValueAttrName string          = "default"
	DescriptionAttrName  string          = "description"
	RulesAttrName        string          = "rules"
)
View Source
const (
	InputTypeAuto string = "auto"
)

Variables

This section is empty.

Functions

func BuildDynamicTypeRegistry

func BuildDynamicTypeRegistry(ctx context.Context, protoDir string, provider fs.Provider) (*protoregistry.Types, error)

Takes a path to the protobuf directory in the config repo, and generates a registry of user-defined types. This registry implements the Resolver interface, which is useful for compiling to json.

func GetTemplate

func GetTemplate(fType feature.FeatureType) ([]byte, error)

func ReBuildDynamicTypeRegistry

func ReBuildDynamicTypeRegistry(ctx context.Context, protoDir string, cw fs.ConfigWriter) (*protoregistry.Types, error)

Note: this method is not safe to be run on ephemeral repos, as it invokes the buf cmd line.

Types

type Builder

type Builder interface {
	Build() (*feature.CompiledFeature, error)
}

type Compiler

type Compiler interface {
	Compile(context.Context) (*feature.CompiledFeature, error)
	Persist(context.Context, *feature.Feature, bool) (bool, error)
}

func NewCompiler

func NewCompiler(registry *protoregistry.Types, ff *feature.FeatureFile, cw fs.ConfigWriter) Compiler

Compile takes the following parameters:

protoDir: path to the proto directory that stores all user-defined proto files
starfilePath: path to the .star file that defines this feature flag
featureName: human-readable name of this feature flag. Also matches the starfile name.

type Formatter

type Formatter interface {
	Format(ctx context.Context) (bool, error)
}

func NewStarFormatter

func NewStarFormatter(filePath, featureName string, cw fs.ConfigWriter) Formatter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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