cue

package
v0.0.0-...-e936fb3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFS

func AddFS(target map[string]load.Source, cwd, prependPath string, files fs.FS) error

func AddFiles

func AddFiles(target map[string]load.Source, cwd string, files ...File) error

func CheckErr

func CheckErr(o Errer) error

func Fmt

func Fmt(file string) error

func FmtBytes

func FmtBytes(data []byte) ([]byte, error)

func FmtCUEInPlace

func FmtCUEInPlace(file string) ([]byte, error)

func ReadCUE

func ReadCUE(file string) ([]byte, error)

func UnmarshalFile

func UnmarshalFile(file string, obj any) error

func WrapErr

func WrapErr(err error) error

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext() *Context

func (*Context) Compile

func (c *Context) Compile(data []byte) (*cue.Value, error)

func (*Context) Decode

func (c *Context) Decode(v *cue.Value, obj any) error

func (*Context) Encode

func (c *Context) Encode(obj any) (*cue.Value, error)

func (*Context) Validate

func (c *Context) Validate(path, typeName string) error

func (*Context) Value

func (c *Context) Value() (*cue.Value, error)

func (*Context) ValueNoSchema

func (c *Context) ValueNoSchema() (*cue.Value, error)

func (Context) WithFS

func (c Context) WithFS(fs ...fs.FS) *Context

func (Context) WithFile

func (c Context) WithFile(name string, data []byte) *Context

func (Context) WithFiles

func (c Context) WithFiles(file ...File) *Context

func (Context) WithNestedFS

func (c Context) WithNestedFS(prepend string, fs fs.FS) *Context

func (Context) WithParser

func (c Context) WithParser(parser ParserFunc) *Context

func (Context) WithSchema

func (c Context) WithSchema(path, typeName string) *Context

type Errer

type Errer interface {
	Err() error
}

type File

type File struct {
	Filename    string
	DisplayName string
	Data        []byte
	Parser      ParserFunc
}

type ParserFunc

type ParserFunc func(name string, src any) (*ast.File, error)

Jump to

Keyboard shortcuts

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