qri: github.com/qri-io/qri/startf/context Index | Files

package context

import "github.com/qri-io/qri/startf/context"


Package Files


type Context Uses

type Context struct {
    // contains filtered or unexported fields

Context carries values across function calls in a transformation

func NewContext Uses

func NewContext(config, secrets map[string]interface{}) *Context

NewContext creates a new contex

func (*Context) GetConfig Uses

func (c *Context) GetConfig(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

GetConfig returns transformation configuration details TODO - supplying a string argument to qri.get_config('foo') should return the single config value instead of the whole map

func (*Context) GetSecret Uses

func (c *Context) GetSecret(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

GetSecret fetches a secret for a given string

func (*Context) SetResult Uses

func (c *Context) SetResult(name string, value starlark.Value)

SetResult places the result of a function call in the results stringDict any results set here will be placed in the context struct field by name

func (*Context) Struct Uses

func (c *Context) Struct() *starlarkstruct.Struct

Struct delivers this context as a starlark struct

Package context imports 4 packages (graph) and is imported by 1 packages. Updated 2019-07-23. Refresh now. Tools for package owners.