Documentation ¶
Overview ¶
Package startf implements dataset transformations using the starlark programming dialect For more info on starlark check github.com/google/starlark
Index ¶
- Constants
- Variables
- func AddMutateFieldCheck(check func(path ...string) error) func(o *ExecOpts)
- func AddQriNodeOpt(node *p2p.QriNode) func(o *ExecOpts)
- func DefaultExecOpts(o *ExecOpts)
- func Error(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func ExecScript(next, prev *dataset.Dataset, opts ...func(o *ExecOpts)) error
- func SetOutWriter(w io.Writer) func(o *ExecOpts)
- type EntryReader
- type ExecOpts
- type HTTPGuard
- type ModuleLoader
Constants ¶
const Version = "0.8.1"
Version is the current version of this startf, this version number will be written with each transformation exectution
Variables ¶
var DefaultModuleLoader = func(thread *starlark.Thread, module string) (dict starlark.StringDict, err error) { return starlib.Loader(thread, module) }
DefaultModuleLoader is the loader ExecScript will use unless configured otherwise
var ErrNotDefined = fmt.Errorf("not defined")
ErrNotDefined is for when a starlark value is not defined or does not exist
var ( // ErrNtwkDisabled is returned whenever a network call is attempted but h.NetworkEnabled is false ErrNtwkDisabled = fmt.Errorf("network use is disabled. http can only be used during download step") )
Functions ¶
func AddMutateFieldCheck ¶
AddMutateFieldCheck provides a checkFunc to ExecScript
func AddQriNodeOpt ¶
AddQriNodeOpt adds a qri node to execution options
func DefaultExecOpts ¶
func DefaultExecOpts(o *ExecOpts)
DefaultExecOpts applies default options to an ExecOpts pointer
func Error ¶
func Error(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
Error halts program execution with an error
func ExecScript ¶
ExecScript executes a transformation against a starlark script file. The next dataset pointer may be modified, while the prev dataset point is read-only. At a bare minimum this function will set transformation details, but starlark scripts can modify many parts of the dataset pointer, including meta, structure, and transform. opts may provide more ways for output to be produced from this function.
func SetOutWriter ¶
SetOutWriter provides a writer to record the "stderr" diagnostic output of the transform script
Types ¶
type EntryReader ¶
type EntryReader struct {
// contains filtered or unexported fields
}
EntryReader implements the dsio.EntryReader interface for starlark.Iterable's
func NewEntryReader ¶
func NewEntryReader(st *dataset.Structure, iter starlark.Iterable) *EntryReader
NewEntryReader creates a new Entry Reader
func (*EntryReader) ReadEntry ¶
func (r *EntryReader) ReadEntry() (e dsio.Entry, err error)
ReadEntry reads one entry from the reader
func (*EntryReader) Structure ¶
func (r *EntryReader) Structure() *dataset.Structure
Structure gives this reader's structure
type ExecOpts ¶
type ExecOpts struct { Node *p2p.QriNode // supply a QriNode to make the 'qri' module available in starlark AllowFloat bool // allow floating-point numbers AllowSet bool // allow set data type AllowLambda bool // allow lambda expressions AllowNestedDef bool // allow nested def statements Secrets map[string]interface{} // passed-in secrets (eg: API keys) Globals starlark.StringDict // global values to pass for script execution MutateFieldCheck func(path ...string) error // func that errors if field specified by path is mutated OutWriter io.Writer // provide a writer to record script "stdout" to ModuleLoader ModuleLoader // starlark module loader function }
ExecOpts defines options for execution
type HTTPGuard ¶
type HTTPGuard struct {
NetworkEnabled bool
}
HTTPGuard protects network requests, only allowing when network is enabled
func (*HTTPGuard) DisableNtwk ¶
func (h *HTTPGuard) DisableNtwk()
DisableNtwk prevents network calls from succeeding
type ModuleLoader ¶
ModuleLoader is a function that can load starlark modules
Directories ¶
Path | Synopsis |
---|---|
Package ds exposes the qri dataset document model into starlark Package ds defines the qri dataset object within starlark outline: ds ds defines the qri dataset object within starlark.
|
Package ds exposes the qri dataset document model into starlark Package ds defines the qri dataset object within starlark outline: ds ds defines the qri dataset object within starlark. |