astutil

package
v0.0.0-...-2016107 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSeqs

func FindSeqs(n ast.Node) *ast.ListLit

FindSeqs finds the seqs field within what is expected to be a valid lineage ast.Node

func FmtNode

func FmtNode(n ast.Node) ([]byte, error)

FmtNode exports a node to CUE standard-fmt'd bytes using standard Thema configuration.

func FmtNodeP

func FmtNodeP(n ast.Node) []byte

FmtNodeP is FmtNode but panics on error.

func Format

func Format(v cue.Value) ast.Node

Format formats a cue.Value using a Thema-standard set of options.

It also sanitizes out weird insertions the CUE compiler makes, as necessary.

func GetFieldByLabel

func GetFieldByLabel(n ast.Node, label string) (*ast.Field, error)

GetFieldByLabel returns the ast.Field with a given label from a struct-ish input.

func LatestSchemaList

func LatestSchemaList(n ast.Node) (*ast.ListLit, error)

LatestSchemaList finds the ListLit for the latest sequence in what is expected to be a valid lineage ast.Node

func SchemaListFor

func SchemaListFor(n ast.Node, majv uint) (*ast.ListLit, error)

SchemaListFor finds the ListLit for a particular major version number in what is expected to be a valid lineage ast.Node

func ToExpr

func ToExpr(n ast.Node) ast.Expr

ToExpr converts a node to an expression. If it is a file, it will return it as a struct. If it is an expression, it will return it as is. Otherwise it panics.

Copied from cuelang.org/go/internal

Types

This section is empty.

Jump to

Keyboard shortcuts

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