cue

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFieldsOptional

func MakeFieldsOptional(ctx *cue.Context, val cue.Value, structLabels []string, fields []string) (cue.Value, int, error)

MakeFieldsOptional marks the given fields as optional (`field?:`) in every struct whose field label is one of structLabels (e.g. "_Metadata_0"). It returns the number of fields made optional.

func Marshal

func Marshal(v cue.Value) ([]byte, error)

func RemoveEmptyStringField

func RemoveEmptyStringField(ctx *cue.Context, val cue.Value) (cue.Value, error)

RemoveEmptyStringField removes any struct field whose label is the empty string literal "". This is a workaround to mitigate issues with cue vet.

func RenameDefinition

func RenameDefinition(ctx *cue.Context, value cue.Value, oldName, newName string) cue.Value

RenameDefinition renames all AST identifiers matching oldName to newName within value.

func SetFieldsDefault

func SetFieldsDefault(ctx *cue.Context, val cue.Value, structLabels []string, fields []string, defaultValue ast.Expr) (cue.Value, int, error)

SetFieldsDefault adds a default value to the given fields (`field: <type> | *<defaultValue>`) in every struct whose field label is one of structLabels (e.g. "_ListSpec_0"), so that the fields can be omitted. It returns the number of fields updated.

func ValueToASTExpr

func ValueToASTExpr(v cue.Value) (ast.Expr, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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