Documentation ¶
Index ¶
- func Call(ctx context.Context, main *compiler.Code, functionName string, ...) (object.Object, error)
- func Eval(ctx context.Context, source string, options ...Option) (object.Object, error)
- func EvalCode(ctx context.Context, main *compiler.Code, options ...Option) (object.Object, error)
- type Config
- type Option
- func WithConcurrency() Option
- func WithGlobal(name string, value any) Option
- func WithGlobalOverride(name string, value any) Option
- func WithGlobals(globals map[string]any) Option
- func WithImporter(i importer.Importer) Option
- func WithListenersAllowed() Option
- func WithLocalImporter(path string) Option
- func WithoutDefaultGlobals() Option
- func WithoutGlobal(name string) Option
- func WithoutGlobals(names ...string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶ added in v0.14.0
func Call( ctx context.Context, main *compiler.Code, functionName string, args []object.Object, options ...Option, ) (object.Object, error)
Call evaluates the precompiled code and then calls the named function. The supplied arguments are passed in the function call. The result of the function call is returned.
Types ¶
type Config ¶ added in v1.1.0
type Config struct {
// contains filtered or unexported fields
}
Config assists in configuring Risor evaluations.
func NewConfig ¶ added in v1.1.0
NewConfig returns a new Risor Config. Use the Risor options functions to customize the configuration.
func (*Config) CombinedGlobals
deprecated
added in
v1.1.0
func (*Config) CompilerOpts ¶ added in v1.1.0
CompilerOpts returns compiler options derived from this configuration.
func (*Config) GlobalNames ¶ added in v1.1.0
GlobalNames returns a list of all global variables names that should be available in a Risor evaluation.
type Option ¶
type Option func(*Config)
Option describes a function used to configure a Risor evaluation.
func WithConcurrency ¶ added in v1.4.0
func WithConcurrency() Option
WithConcurrency enables the use of concurrency in Risor evaluations.
func WithGlobal ¶ added in v0.14.0
WithGlobal supplies a single named global variable to the Risor evaluation.
func WithGlobalOverride ¶ added in v1.3.0
WithGlobalOverride replaces the a global or module builtin with the given value
func WithGlobals ¶ added in v0.14.0
WithGlobals provides global variables that are made available to Risor evaluations. This option is additive, so multiple WithGlobals options may be supplied. If the same key is supplied multiple times, the last supplied value is used.
func WithImporter ¶
WithImporter supplies an Importer that will be used to execute import statements.
func WithListenersAllowed ¶ added in v1.4.0
func WithListenersAllowed() Option
WithListenersAllowed allows opening sockets for listening.
func WithLocalImporter ¶ added in v0.8.0
WithLocalImporter enables importing Risor modules from the given directory.
func WithoutDefaultGlobals ¶ added in v0.14.0
func WithoutDefaultGlobals() Option
WithoutDefaultGlobals opts out of all default global builtins and modules.
func WithoutGlobal ¶ added in v1.3.0
WithoutGlobal opts out of a given global builtin or module. If the name can't be resolved, this is a no-op. This does operate on nested modules.
func WithoutGlobals ¶ added in v1.3.0
WithoutGlobals removes multiple global builtins or modules.
Directories ¶
Path | Synopsis |
---|---|
Package ast defines the abstract syntax tree representation of Risor code.
|
Package ast defines the abstract syntax tree representation of Risor code. |
Package builtins defines a default set of built-in functions.
|
Package builtins defines a default set of built-in functions. |
cmd
|
|
risor
Module
|
|
risor-api
Module
|
|
risor-docs
Module
|
|
risor-lsp
Module
|
|
risor-modgen
Module
|
|
Package compiler is used to compile a Risor abstract syntax tree (AST) into the corresponding bytecode.
|
Package compiler is used to compile a Risor abstract syntax tree (AST) into the corresponding bytecode. |
Package dis supports analysis of Risor bytecode by disassembling it.
|
Package dis supports analysis of Risor bytecode by disassembling it. |
Package errz defines a FriendlyError interface for errors that have a human friendly message in addition to the default error message.
|
Package errz defines a FriendlyError interface for errors that have a human friendly message in addition to the default error message. |
examples
|
|
go/struct
Module
|
|
Package importer provides a common interface used to import Risor modules.
|
Package importer provides a common interface used to import Risor modules. |
internal
|
|
tmpl
Package tmpl is used to parse Risor string templates.
|
Package tmpl is used to parse Risor string templates. |
Package lexer provides a Lexer that takes Risor source code as input and outputs a stream of tokens to be consumed by a parser.
|
Package lexer provides a Lexer that takes Risor source code as input and outputs a stream of tokens to be consumed by a parser. |
Package limits provides an interface and helpers for restricting resource usage during Risor evaluations.
|
Package limits provides an interface and helpers for restricting resource usage during Risor evaluations. |
modules
|
|
aws
Module
|
|
bcrypt
Module
|
|
carbon
Module
|
|
cli
Module
|
|
gha
Module
|
|
image
Module
|
|
jmespath
Module
|
|
kubernetes
Module
|
|
pgx
Module
|
|
semver
Module
|
|
sql
Module
|
|
template
Module
|
|
uuid
Module
|
|
vault
Module
|
|
Package object provides the standard set of Risor object types.
|
Package object provides the standard set of Risor object types. |
Package op defines opcodes used by the Risor compiler and virtual machine.
|
Package op defines opcodes used by the Risor compiler and virtual machine. |
s3fs
Module
|
|
Package parser is used to generate the abstract syntax tree (AST) for a program.
|
Package parser is used to generate the abstract syntax tree (AST) for a program. |
tests
|
|
Package token defines language keywords and tokens used when lexing source code.
|
Package token defines language keywords and tokens used when lexing source code. |
Package vm provides a VirtualMachine that executes compiled Risor code.
|
Package vm provides a VirtualMachine that executes compiled Risor code. |