value

package
v0.0.0-...-8789a92 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultPackageHeader = "package main\n"

DefaultPackageHeader describes the default package header for CUE files.

Variables

This section is empty.

Functions

func AddFile

func AddFile(bi *build.Instance, filename string, src interface{}) error

AddFile add file to the instance

func FieldPath

func FieldPath(paths ...string) cue.Path

FieldPath return the cue path of the given paths

func ProcessScript

func ProcessScript(root *ast.File) error

ProcessScript preprocess the script builtin function.

func TagFieldOrder

func TagFieldOrder(root *ast.File) error

TagFieldOrder add step tag.

Types

type Value

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

Value is an object with cue.context and vendors

func NewValue

func NewValue(s string, pd *packages.PackageDiscover, tagTempl string, opts ...func(*ast.File) error) (*Value, error)

NewValue new a value

func NewValueWithInstance

func NewValueWithInstance(instance *build.Instance, pd *packages.PackageDiscover, tagTempl string) (*Value, error)

NewValueWithInstance new value with instance

func (*Value) CueValue

func (val *Value) CueValue() cue.Value

CueValue return cue.Value

func (*Value) Error

func (val *Value) Error() error

Error return value's error information.

func (*Value) Field

func (val *Value) Field(label string) (cue.Value, error)

Field return the cue value corresponding to the specified field

func (*Value) FieldName

func (val *Value) FieldName() string

FieldName return value's field name

func (*Value) FillObject

func (val *Value) FillObject(x interface{}, paths ...string) error

FillObject unify the value with object x at the given path.

func (*Value) FillRaw

func (val *Value) FillRaw(x string, paths ...string) error

FillRaw unify the value with the cue format string x at the given path.

func (*Value) FillValueByScript

func (val *Value) FillValueByScript(x *Value, path string) error

FillValueByScript unify the value x at the given script path.

func (*Value) GetBool

func (val *Value) GetBool(paths ...string) (bool, error)

GetBool get the int value at a path starting from v.

func (*Value) GetInt64

func (val *Value) GetInt64(paths ...string) (int64, error)

GetInt64 get the int value at a path starting from v.

func (*Value) GetString

func (val *Value) GetString(paths ...string) (string, error)

GetString get the string value at a path starting from v.

func (*Value) GetStringSlice

func (val *Value) GetStringSlice(paths ...string) ([]string, error)

GetStringSlice get string slice from val

func (*Value) LookupByScript

func (val *Value) LookupByScript(script string) (*Value, error)

LookupByScript reports the value by cue script.

func (*Value) LookupValue

func (val *Value) LookupValue(paths ...string) (*Value, error)

LookupValue reports the value at a path starting from val

func (*Value) MakeValue

func (val *Value) MakeValue(s string) (*Value, error)

MakeValue generate an value with same runtime

func (*Value) OpenCompleteValue

func (val *Value) OpenCompleteValue() error

OpenCompleteValue make that the complete value can be modified.

func (*Value) SetObject

func (val *Value) SetObject(x interface{}, paths ...string) error

SetObject set the value with object x at the given path.

func (*Value) SetValueByScript

func (val *Value) SetValueByScript(v *Value, path ...string) error

SetValueByScript set the value v at the given script path. nolint:staticcheck

func (*Value) StepByFields

func (val *Value) StepByFields(handle func(name string, in *Value) (bool, error)) error

StepByFields process the fields in order

func (*Value) StepByList

func (val *Value) StepByList(handle func(name string, in *Value) (bool, error)) error

StepByList process item in list.

func (*Value) String

func (val *Value) String(opts ...func(node ast.Node) ast.Node) (string, error)

String return value's cue format string

func (*Value) SubstituteInStruct

func (val *Value) SubstituteInStruct(expr ast.Expr, key string) error

SubstituteInStruct substitute expr in struct lit value nolint:staticcheck

func (*Value) UnmarshalTo

func (val *Value) UnmarshalTo(x interface{}) error

UnmarshalTo unmarshal value into golang object

Jump to

Keyboard shortcuts

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