Documentation ¶
Index ¶
- Constants
- func AddFile(bi *build.Instance, filename string, src interface{}) error
- func FieldPath(paths ...string) cue.Path
- func ProcessScript(root *ast.File) error
- func TagFieldOrder(root *ast.File) error
- type Value
- func (val *Value) CueValue() cue.Value
- func (val *Value) Error() error
- func (val *Value) Field(label string) (cue.Value, error)
- func (val *Value) FieldName() string
- func (val *Value) FillObject(x interface{}, paths ...string) error
- func (val *Value) FillRaw(x string, paths ...string) error
- func (val *Value) FillValueByScript(x *Value, path string) error
- func (val *Value) GetBool(paths ...string) (bool, error)
- func (val *Value) GetInt64(paths ...string) (int64, error)
- func (val *Value) GetString(paths ...string) (string, error)
- func (val *Value) GetStringSlice(paths ...string) ([]string, error)
- func (val *Value) LookupByScript(script string) (*Value, error)
- func (val *Value) LookupValue(paths ...string) (*Value, error)
- func (val *Value) MakeValue(s string) (*Value, error)
- func (val *Value) OpenCompleteValue() error
- func (val *Value) SetObject(x interface{}, paths ...string) error
- func (val *Value) SetValueByScript(v *Value, path ...string) error
- func (val *Value) StepByFields(handle func(name string, in *Value) (bool, error)) error
- func (val *Value) StepByList(handle func(name string, in *Value) (bool, error)) error
- func (val *Value) String(opts ...func(node ast.Node) ast.Node) (string, error)
- func (val *Value) SubstituteInStruct(expr ast.Expr, key string) error
- func (val *Value) UnmarshalTo(x interface{}) error
Constants ¶
const DefaultPackageHeader = "package main\n"
DefaultPackageHeader describes the default package header for CUE files.
Variables ¶
This section is empty.
Functions ¶
func ProcessScript ¶
ProcessScript preprocess the script builtin function.
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) FillObject ¶
FillObject unify the value with object x at the given path.
func (*Value) FillValueByScript ¶
FillValueByScript unify the value x at the given script path.
func (*Value) GetStringSlice ¶
GetStringSlice get string slice from val
func (*Value) LookupByScript ¶
LookupByScript reports the value by cue script.
func (*Value) LookupValue ¶
LookupValue reports the value at a path starting from val
func (*Value) OpenCompleteValue ¶
OpenCompleteValue make that the complete value can be modified.
func (*Value) SetValueByScript ¶ added in v0.4.0
SetValueByScript set the value v at the given script path. nolint:staticcheck
func (*Value) StepByFields ¶
StepByFields process the fields in order
func (*Value) StepByList ¶
StepByList process item in list.
func (*Value) SubstituteInStruct ¶ added in v0.3.5
SubstituteInStruct substitute expr in struct lit value nolint:staticcheck
func (*Value) UnmarshalTo ¶
UnmarshalTo unmarshal value into golang object