imports

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFromLocalPath

func ReadFromLocalPath(path string) ([]map[string]interface{}, error)

func ResolveImportLocalPath

func ResolveImportLocalPath(rootPath string, importPath string) (string, error)

func TrimToDepth

func TrimToDepth(module *Module, depth int) bool

TrimToDepth returns true if it trimmed away any imports.

Types

type EvalContext

type EvalContext struct {
	RawToTyped func(raw interface{}) (interface{}, error)

	// Get an "absolute" path for a given import.
	ResolveImportPath func(rootPath string, importPath string) (string, error)

	// Read the contents of a given path.
	ReadFromPath func(path string) ([]map[string]interface{}, error)
}

func (*EvalContext) EvaluateExport

func (c *EvalContext) EvaluateExport(module *Module, params map[string]interface{}, export *Resource) error

func (*EvalContext) EvaluateImport

func (c *EvalContext) EvaluateImport(inModule *Module, inModuleParams map[string]interface{}, imprt *Import) error

func (*EvalContext) EvaluateModule

func (c *EvalContext) EvaluateModule(module *Module, params map[string]interface{}) error

func (*EvalContext) Parse

func (c *EvalContext) Parse(rootPath string) ([]Module, error)

func (*EvalContext) ParseComponent

func (c *EvalContext) ParseComponent(rootPath string, obj map[string]interface{}) (*Module, error)

func (*EvalContext) ResolverForModule

func (c *EvalContext) ResolverForModule(module *Module, params map[string]interface{}) template.Resolver

type Import

type Import struct {
	Name   string
	Path   string
	Params map[string]interface{} `json:"Params,omitempty"`

	// IsEvaluated have the Params been applied to the Module?
	IsEvaluated bool `json:"-"`

	Module *Module
}

type Module

type Module struct {
	Path    string              `json:"-"`
	Imports []*Import           `json:"Imports,omitempty"`
	Params  map[string]ParamDef `json:"Params,omitempty"`

	// IsEvaluated has the Raw yaml in Exports been evaluated (template holes filled, etc)?
	IsEvaluated bool `json:"-"`

	Export Resource
}

type ParamDef

type ParamDef struct {
	Description string
	Default     interface{}
}

type Resource

type Resource struct {
	// Raw yaml parsed as string or map[string]interface{}
	Raw map[string]interface{} `json:"Value"`

	// TypedResult a koki object (or other object with special meaning)
	TypedResult interface{} `json:"-"`
}

Jump to

Keyboard shortcuts

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