cuefrontend

package
v0.0.360 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Overview

This is about parsing Fn-specific dialect of Cue.

Index

Constants

View Source
const (
	WorkspaceFile       = "ns-workspace.cue"
	LegacyWorkspaceFile = "fn-workspace.cue"
)
View Source
const (
	Version_SyntaxVersionMarker = 54
)

Variables

View Source
var (
	ConsumeNoValue = &consumeNoValue
)
View Source
var ModuleFields = []string{
	"module", "requirements", "replace", "dependency", "prebuilts", "environment",
	"experimentalProtoModuleImports", "enabledFeatures",
}

Consider using https://pkg.go.dev/reflect#StructTag to infer this from cueModule

View Source
var ModuleLoader moduleLoader

Functions

func InjectedScope

func InjectedScope(env *schema.Environment) *cueInjectedScope

Variables that always available for the user in CUE files, without explicit importing.

func LoadResource

func LoadResource(fsys fs.FS, loc pkggraph.Location, path string) (*schema.FileContents, error)

func ParseNaming added in v0.0.96

func ParseNaming(v *fncue.CueV) (*schema.Naming, error)

func ParsePackage added in v0.0.108

Common parsing code between new and old syntaxes.

func ParsePort added in v0.0.324

func ParsePort(name string, port CuePort) (*schema.Endpoint_Port, error)

func ValidateNoExtraFields added in v0.0.117

func ValidateNoExtraFields(loc pkggraph.Location, messagePrefix string, v *fncue.CueV, allowedFields []string) error

Types

type CuePort added in v0.0.324

type CuePort struct {
	ContainerPort int32  `json:"containerPort"`
	HostPort      int32  `json:"hostPort"`
	Protocol      string `json:"protocol,omitempty"`
}

type CueResourceInstance

type CueResourceInstance struct {
	Class     string            `json:"class"`
	Provider  string            `json:"provider"`
	RawIntent any               `json:"intent"`
	Resources map[string]string `json:"resources"`

	// Prefer the definition above.
	Kind     string `json:"kind"`
	On       string `json:"on"`
	RawInput any    `json:"input"`
}

type EvalFuncs

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

func (*EvalFuncs) Fetch

func (s *EvalFuncs) Fetch(ctx context.Context, v cue.Value, kp fncue.KeyAndPath) (interface{}, error)

func (*EvalFuncs) WithFetcher

func (s *EvalFuncs) WithFetcher(key string, f FetcherFunc) *EvalFuncs

type Fetcher

type Fetcher interface {
	Fetch(context.Context, cue.Value, fncue.KeyAndPath) (interface{}, error)
}

type FetcherFunc

type FetcherFunc func(context.Context, cue.Value) (interface{}, error)

func FetchPackage

func FetchPackage(pl pkggraph.PackageLoader) FetcherFunc

func FetchProto

func FetchProto(pl pkggraph.PackageLoader, fsys fs.FS, loc pkggraph.Location) FetcherFunc

func FetchResource

func FetchResource(fsys fs.FS, loc pkggraph.Location) FetcherFunc

func FetchServer

func FetchServer(packages pkggraph.PackageLoader, stack pkggraph.StackEndpoints) FetcherFunc

func FetchServerWorkspace

func FetchServerWorkspace(loc protos.Location) FetcherFunc

type NewSyntaxParser

type NewSyntaxParser interface {
	ParsePackage(ctx context.Context, partial *fncue.Partial, loc pkggraph.Location) (*pkggraph.Package, error)
}

type ResourceList

type ResourceList struct {
	Refs      []string
	Instances map[string]*fncue.CueV
}

func ParseResourceList

func ParseResourceList(v *fncue.CueV) (*ResourceList, error)

func (*ResourceList) ToPack

type WorkspaceLoader

type WorkspaceLoader struct {
	PackageLoader parsing.EarlyPackageLoader
}

func (WorkspaceLoader) SnapshotDir

Directories

Path Synopsis
integration
api
web

Jump to

Keyboard shortcuts

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