runtime

package
v0.6.8-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 24 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 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

	// 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

	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) 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) 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 struct {
	CueLoadingTime time.Duration
	GenLoadingTime time.Duration
	GenRunningTime 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