Documentation
¶
Index ¶
- func DecodeMetadata(field *ast.Field) error
- func EncodeMetadata(field *ast.Field) error
- func FindAndValidateField(sl *ast.StructLit, fieldName string, validator fieldValidator) (found bool, err error)
- func GetFieldByPath(node ast.Node, path string) (*ast.Field, bool)
- func GetFieldLabel(label ast.Label) string
- func GetNodeByPath(node ast.Node, path string) (ast.Node, *ast.Field, bool)
- func ParseCueContent(content string) (*ast.StructLit, bool, bool, error)
- func StringifyStructLitAsCueString(structLit *ast.StructLit) (*ast.BasicLit, error)
- func TrimCueRawString(s string) string
- func UpdateNodeByPath(root ast.Node, path string, newExpr ast.Expr) bool
- func ValidateCueStringLiteral[T ast.Node](lit *ast.BasicLit, validator func(T) error) error
- func WrapCueStruct(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeMetadata ¶
DecodeMetadata decodes a CUE string literal in the metadata fields to native CUE expressions
func EncodeMetadata ¶
EncodeMetadata encodes native CUE in the metadata fields to a CUE string literal
func FindAndValidateField ¶
func FindAndValidateField(sl *ast.StructLit, fieldName string, validator fieldValidator) (found bool, err error)
FindAndValidateField searches for a field at the top level or within top-level if statements
func GetFieldByPath ¶
GetFieldByPath retrieves a field by its path in the AST
func GetFieldLabel ¶
GetFieldLabel retrieves the label of a field in the AST
func GetNodeByPath ¶
GetNodeByPath retrieves a node by its path in the AST
func ParseCueContent ¶ added in v1.10.5
ParseCueContent parses CUE content and extracts struct fields, skipping imports/packages
func StringifyStructLitAsCueString ¶
StringifyStructLitAsCueString converts a StructLit to a CUE string literal representation
func TrimCueRawString ¶
TrimCueRawString trims a CUE raw string literal and handles escape sequences
func UpdateNodeByPath ¶
UpdateNodeByPath updates a node in the AST by its path
func ValidateCueStringLiteral ¶
ValidateCueStringLiteral validates a CUE string literal by parsing it and applying a custom validator function
func WrapCueStruct ¶
WrapCueStruct wraps a string in a CUE struct format
Types ¶
This section is empty.