Documentation ¶
Index ¶
Constants ¶
const EntryPoint = "main"
EntryPoint defines the name of the method that will be called when running a script (if it exists) in addition to executing top level statements.
Variables ¶
var ( // ErrMalformattedKwarg occurs when a keyword argument passed to a starlark function is malformatted. ErrMalformattedKwarg = errors.New("malformatted keyword argument for method call") // ErrMissingKwarg occurs when a keyword argument is missing from a starlark function call. ErrMissingKwarg = errors.New("missing keyword argument for method call") // ErrMissingArg occurs when an argument is missing from a starlark function call. ErrMissingArg = errors.New("missing argument for method call") // ErrInvalidArgType occurs when an argument provided to a starlark function call has the wrong type. ErrInvalidArgType = errors.New("invalid argument type provided to method") // ErrMissingLibrary occurs when attempting to load a library that doesn't exist. ErrMissingLibrary = errors.New("could not find library to load") // ErrInvalidTypeConversion occurs when converting a golang type to a starlark.Value fails. ErrInvalidTypeConversion = errors.New("could not convert golang value to starlark.Value") // ErrInvalidKwarg occurs when a user incorrectly passes a kwarg to a starlark function ErrInvalidKwarg = errors.New("invalid kwarg was passed to the method") )
Functions ¶
This section is empty.
Types ¶
type ArgParser ¶
type ArgParser interface { RestrictKwargs(kwargs ...string) error GetString(index int) (string, error) GetStringByName(name string) (string, error) GetInt(index int) (int64, error) GetIntByName(name string) (int64, error) GetBool(index int) (bool, error) GetBoolByName(kwarg string) (bool, error) }
An ArgParser enables golang function implementations to retrieve the positional and keyword arguments provided to the starlark method call.
type Func ¶
Func provides a simple wrapper that enables a golang function to be exposed to starlark.
type Option ¶
type Option func(*Script)
An Option enables additional customization of script configuration and execution.
func WithLibraries ¶
WithLibraries adds one or more libraries to the script's execution environment.
func WithLibrary ¶
WithLibrary is an option to add a library to the script's execution environment.
func WithOutput ¶
WithOutput sets the destination for script execution output.
type Script ¶
type Script struct { io.Reader // Read() instructions to execute io.Writer // Write() execution output ID string Builtins map[string]Func Libraries map[string]Library }
A Script provides metadata and instructions to be executed by the interpreter.