loader

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	*build.Instance
	// contains filtered or unexported fields
}

Instance is a wrapper around Cue instance to implement additional methods It also caches various data to improve performances and data fetching

func Build

func Build(src string, _ map[string]fs.FS, file string) (*Instance, error)

Build a cue instance from the files in fs.

func Dir

func Dir(src, file string) (*Instance, error)

Dir load a cue instance from a directory

func File

func File(src, file string) (*Instance, error)

File load a cue instance from a single file

func NewInstance

func NewInstance(i *build.Instance) *Instance

NewInstance is a constructor around Instance to correctly initialize cache fields

func (*Instance) GetDefinition

func (i *Instance) GetDefinition(path string) (*Value, error)

GetDefinition return a definition if found or an error

func (*Instance) GetNode

func (i *Instance) GetNode(def string) (ast.Node, error)

func (*Instance) GetValidatedValue

func (i *Instance) GetValidatedValue() (*Value, error)

GetValidatedValue return a value if it's validated

func (*Instance) GetValue

func (i *Instance) GetValue() (*Value, error)

GetValue return a built instance value

func (*Instance) LoadDefinitions

func (i *Instance) LoadDefinitions() error

LoadDefinitions list and store all definitions of an instance

func (*Instance) String

func (i *Instance) String() string

func (*Instance) Validate

func (i *Instance) Validate() error

Validate verify that instance value is correct It return error if there is an error

type Value

type Value struct {
	cue.Value
}

Value is a wrapper around cue.Value to implement additional utility methods

func (*Value) IsDefinition

func (v *Value) IsDefinition() bool

IsDefinition return true if the current value is a definition. It checks it through path name.

func (*Value) ListDefinitions

func (v *Value) ListDefinitions() ([]*Value, error)

ListDefinitions recursively walk through cue Value to retrieve all definition defines in it.

func (*Value) ListFieldDoc

func (v *Value) ListFieldDoc() (string, error)

ListFieldDoc builds a text that contains all fields of a CUE value with their associated documentation. It also walks through children until find primitive dagger task.

TODO (TomChv): Implement special handling for primitive type like `dagger.#FS`

Jump to

Keyboard shortcuts

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