runtime

package
v0.6.9-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatEnricher added in v0.6.8

type ChatEnricher func(*Runtime, *chat.Chat) error

type DatamodelEnricher added in v0.6.8

type DatamodelEnricher func(*Runtime, *datamodel.Datamodel) error

type FlowEnricher added in v0.6.9

type FlowEnricher func(*Runtime, *flow.Flow) error

type GeneratorEnricher added in v0.6.8

type GeneratorEnricher func(*Runtime, *gen.Generator) error

type Runtime

type Runtime struct {
	sync.Mutex

	// original flags used to load the CUE
	Flags flags.RootPflagpole

	// Other important dirs when loading templates (auto set)
	WorkingDir    string
	CueModuleRoot string
	RootToCwd     string // module root -> working dir (foo/bar)
	CwdToRoot     string // module root <- working dir (../..)
	// OutputDir     string  // where gen wants to write (tbd, other commands too)
	OriginalWkdir string // when we need to cd and then output back to this directory (create related, but could expand)

	// CUE related fields
	Entrypoints    []string
	CueContext     *cue.Context
	CueConfig      *load.Config
	BuildInstances []*build.Instance
	CueErrors      []error
	FieldOpts      []cue.Option

	// this is a bit hacky, but we use this with vet to validate data (and probably st as well)
	DontPlaceOrphanedFiles bool

	// The CUE value after all loading
	Value cue.Value

	// we need to rethink how we organize the code
	// in each of these packages so we can separate
	// the commands from the types and core logic
	Nodes      []*hof.Node[any]
	Chats      []*chat.Chat
	Datamodels []*datamodel.Datamodel
	Generators []*gen.Generator
	Workflows  []*flow.Flow

	Stats RuntimeStats
	// contains filtered or unexported fields
}

This is the hof Runtime that backs most commands

func New added in v0.6.8

func New(entrypoints []string, rflags flags.RootPflagpole) (*Runtime, error)

func (*Runtime) EnrichChats added in v0.6.8

func (R *Runtime) EnrichChats(chats []string, enrich ChatEnricher) error

func (*Runtime) EnrichDatamodels added in v0.6.8

func (R *Runtime) EnrichDatamodels(datamodels []string, enrich DatamodelEnricher) error

func (*Runtime) EnrichFlows added in v0.6.9

func (R *Runtime) EnrichFlows(flows []string, enrich FlowEnricher) error

func (*Runtime) EnrichGenerators added in v0.6.8

func (R *Runtime) EnrichGenerators(generators []string, enrich GeneratorEnricher) error

func (*Runtime) Load added in v0.6.8

func (R *Runtime) Load() (err error)

func (*Runtime) LoadOrphanedFile added in v0.6.9

func (R *Runtime) LoadOrphanedFile(f *build.File, pkgName string, root, dir string, index, total int) (F *ast.File, err error)

func (*Runtime) OutputDir added in v0.6.8

func (R *Runtime) OutputDir(dir string) string

OutputDir returns the absolute path to output dir for this runtime. It accounts for module root and relative directories.

type RuntimeStats added in v0.6.8

type RuntimeStats map[string]time.Duration

func (RuntimeStats) Add added in v0.6.9

func (S RuntimeStats) Add(name string, dur time.Duration)

func (RuntimeStats) String added in v0.6.8

func (S RuntimeStats) String() string

Jump to

Keyboard shortcuts

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