Documentation
¶
Index ¶
- func MakeFieldsOptional(ctx *cue.Context, val cue.Value, structLabels []string, fields []string) (cue.Value, int, error)
- func Marshal(v cue.Value) ([]byte, error)
- func RemoveEmptyStringField(ctx *cue.Context, val cue.Value) (cue.Value, error)
- func RenameDefinition(ctx *cue.Context, value cue.Value, oldName, newName string) cue.Value
- func SetFieldsDefault(ctx *cue.Context, val cue.Value, structLabels []string, fields []string, ...) (cue.Value, int, error)
- func ValueToASTExpr(v cue.Value) (ast.Expr, error)
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 RemoveEmptyStringField ¶
RemoveEmptyStringField removes any struct field whose label is the empty string literal "". This is a workaround to mitigate issues with cue vet.
func RenameDefinition ¶
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.
Types ¶
This section is empty.