cue

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

README

Develop Tips

The following packages need to be tested without external/tool dependencies, So that the cue-sh/unity can do verification

  • github.com/kubevela/kubevela/pkg/cue/definition
  • github.com/kubevela/kubevela/pkg/cue/model
  • github.com/kubevela/kubevela/pkg/cue/model/sets
  • github.com/kubevela/kubevela/pkg/cue/process
  • github.com/kubevela/kubevela/pkg/cue/task
  • github.com/kubevela/kubevela/pkg/cue/packages

Documentation

Index

Constants

View Source
const (
	// UsagePrefix defines the usage display for KubeVela CLI
	UsagePrefix = "+usage="
	// ShortPrefix defines the short argument for KubeVela CLI
	ShortPrefix = "+short="
	// AliasPrefix is an alias of the name of a parameter element, in order to making it more friendly to Cli users
	AliasPrefix = "+alias="
	// IgnorePrefix defines parameter in system level which we don't want our end user to see for KubeVela CLI
	IgnorePrefix = "+ignore"
)
View Source
const BaseTemplate = `

context: {
  name: string
  config?: [...{
    name: string
    value: string
  }]
}
`

BaseTemplate include base info provided by KubeVela for CUE template

Variables

View Source
var ErrParameterNotExist = errors.New("parameter not exist")

ErrParameterNotExist represents the parameter field is not exist in CUE template

Functions

func FillUnstructuredObject added in v1.4.0

func FillUnstructuredObject(v *value.Value, obj runtime.Unstructured, paths ...string) error

FillUnstructuredObject fill runtime.Unstructured to *value.Value

func GetDefault

func GetDefault(val cue.Value) interface{}

GetDefault evaluate default Go value from CUE

func GetParameters

func GetParameters(templateStr string, pd *packages.PackageDiscover) ([]types.Parameter, error)

GetParameters get parameter from cue template

func IntifyValues added in v1.1.0

func IntifyValues(raw interface{}) interface{}

IntifyValues will make values to int. JSON marshalling of user values will put integer into float, we have to change it back so that CUE check will succeed.

func RetrieveComments

func RetrieveComments(value cue.Value) (string, string, string, bool)

RetrieveComments will retrieve Usage, Short, Alias and Ignore from CUE Value

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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