static

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	FeatureConstructor   starlark.String = "feature"
	ExportConstructor    starlark.String = "export"
	ConfigConstructor    starlark.String = "Config"
	ResultVariableName   string          = "result"
	DefaultValueAttrName string          = "default"
	DescriptionAttrName  string          = "description"
	MetadataAttrName     string          = "metadata"
	// TODO: Fully migrate to overrides over rules
	RulesAttrName     string = "rules"
	OverridesAttrName string = "overrides"
	InputTypeAuto     string = "auto"
)

Variables

View Source
var (
	ErrUnsupportedStaticParsing = errors.New("unsupported static parsing")
)

Functions

func ExprToProto added in v0.2.23

func ExprToProto(expr build.Expr, f *featurev1beta1.StaticFeature, registry *protoregistry.Types) (proto.Message, error)

Returns (nil, err) if the message is not protobuf.

func NewWalker

func NewWalker(filename string, starBytes []byte, registry *protoregistry.Types, nv feature.NamespaceVersion) *walker

func ProtoToStatic added in v0.2.23

Given a proto message and the import statement that the type of the message is provided by, constructs a starlark expression defining the proto message.

func ReflectValueToExpr added in v0.2.23

func ReflectValueToExpr(imports []*featurev1beta1.ImportStatement, fieldDesc protoreflect.FieldDescriptor, val *protoreflect.Value, meta *featurev1beta1.StarMeta) (build.Expr, error)

Types

type Walker

type Walker interface {
	Build() (*featurev1beta1.StaticFeature, error)
	// Note: this method will perform mutations based on the V3 ruleslang
	// AST if it exists. If not, it will fall back to the ruleString
	// provided in the feature.
	// Note: static mutation is supported for all lekko types with the following
	// caveat: Any feature that has advanced starlark such as helper functions,
	// list comprehension, etc will fail to be statically parsed at the moment.
	Mutate(f *featurev1beta1.StaticFeature) ([]byte, error)
	// Returns the formatted bytes.
	Format() ([]byte, error)
}

Walker provides methods to statically read and manipulate .star files that hold lekko features.

Jump to

Keyboard shortcuts

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