outputs

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StructTag                   = "ns"
	StructTagConnectionName     = "connectionName"
	StructTagConnectionType     = "connectionType"
	StructTagConnectionContract = "connectionContract"
	StructTagOptional           = "optional"
)

Functions

func CheckValidConnectionField

func CheckValidConnectionField(obj interface{}, fieldType reflect.Type) error

func CheckValidField

func CheckValidField(obj interface{}, fieldType reflect.Type) error

Types

type ErrInvalidContractField

type ErrInvalidContractField struct {
	ObjectType reflect.Type
	FieldType  reflect.Type
	Message    string
}

func (ErrInvalidContractField) Error

func (e ErrInvalidContractField) Error() string

type ErrMissingRequiredConnection

type ErrMissingRequiredConnection struct {
	ConnectionName     string
	ConnectionType     string
	ConnectionContract string
}

func (ErrMissingRequiredConnection) Error

type ErrMissingRequiredOutput

type ErrMissingRequiredOutput struct {
	Name string
}

func (ErrMissingRequiredOutput) Error

func (e ErrMissingRequiredOutput) Error() string

type Field

type Field struct {
	Field              reflect.StructField
	Tag                string
	Name               string
	ConnectionType     string
	ConnectionName     string
	ConnectionContract string
	Optional           bool
}

Field is a representation of a struct tag that is specific to nullstone outputs You can define an output mapping directly to a workspace or to outputs through a connection in that workspace

Examples:

type Outputs struct {
  Output1        string            `ns:"output1"`
  OptionalOutput string            `ns:"optional_output,optional"`
  MapOutput      map[string]string `ns:"map_output"`

  Dependency DependencyOutputs `ns:",connectionType:some-dependency"`
}
type DependencyOutputs struct {
  Output2 string `ns:"output2"`
}

Notes:

All fields that that map connections must be a well-defined struct
If you want to ignore a member in the struct, use `ns:"-"`
If you want to make a field/connection optional, add `ns:"output,optional"`

func GetFields

func GetFields(typ reflect.Type) []Field

func (Field) InitializeConnectionValue

func (f Field) InitializeConnectionValue(obj interface{}) interface{}

func (Field) SafeSet

func (f Field) SafeSet(sourceObj interface{}, outputs types.Outputs) error

type Retriever

type Retriever struct {
	NsConfig api.Config
}

func (*Retriever) GetConnectionWorkspace

func (r *Retriever) GetConnectionWorkspace(source *types.Workspace, connectionName, connectionType, connectionContract string) (*types.Workspace, error)

GetConnectionWorkspace gets the workspace from nullstone through a connection from the source workspace This will search through connections matching on connectionName and connectionType Specify "" to ignore filtering for that field One of either connectionName or connectionType must be specified

func (*Retriever) Retrieve

func (r *Retriever) Retrieve(workspace *types.Workspace, obj interface{}) error

Retrieve is capable of retrieving all outputs for a given workspace To properly use, the input obj must be a pointer to a struct that contains fields that map to outputs Struct tags on each field within the struct define how to read the outputs from nullstone APIs See Field for more details

Jump to

Keyboard shortcuts

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