cue

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name string
	// contains filtered or unexported fields
}

File is a wrapper around a cue file. It provides methods for working with cue files.

func Export

func Export(name string, v cue.Value, opts ...cue.Option) (*File, error)

Export exports the cue value to a cue file.

func New

func New(name, filepath string, src any) (*File, error)

New creates a new File from a cue file. src must be a string, []byte, or io.Reader. if src is nil, the file is read from filepath.

func (*File) Comments

func (f *File) Comments() string

Comments returns the comments of the top Node of the cue file. It returns an empty string if there are no comments.

func (*File) Eval

func (f *File) Eval() (*File, error)

Eval evaluates the cue file. It expects the cue file to be well formed. Optional fields and attributes are removed.

func (*File) EvalWithoutPrivateFields

func (f *File) EvalWithoutPrivateFields() (*File, error)

EvalWithoutPrivateFields evaluates the cue file and removes any private fields. note: calling Eval() after Eval() EvalWithoutPrivateFields() will add the private fields back while removing the attributes.

func (*File) Format

func (f *File) Format() ([]byte, error)

Format formats the cue file.

func (*File) Merge

func (f *File) Merge(schema *File, parents ...cue.Selector) (*File, error)

Merge merges the schema with the data. It strip any private fields from the schema.

func (*File) Sanitize

func (f *File) Sanitize() error

Sanitize makes sure the cue file is well formed.

func (*File) SchemaVersion

func (f *File) SchemaVersion() (string, error)

SchemaVersion returns the schema version of the cue file.

func (*File) Unify

func (f *File) Unify(files []*File) (*File, error)

Unify merges several cue files into one. Unify reports the greatest lower bound of the given files.

func (*File) Validate

func (f *File) Validate(schema *File) error

Validate validates the cue file against the given schema.

func (*File) Vet

func (f *File) Vet() error

Vet validates the cue file. It expects the cue file to be well formed and with concrete values.

func (*File) Yaml

func (f *File) Yaml() ([]byte, error)

Yaml returns the yaml representation of the cue file.

Jump to

Keyboard shortcuts

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