extractors

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModuleEventLoop

func NewModuleEventLoop(
	printer console.Printer,
	modCtx modules.RuntimeContext,
	programs ...*goja.Program,
) (*eventloop.EventLoop, error)

func RunAndWaitForResult

func RunAndWaitForResult(
	rt *goja.Runtime,
	fn goja.Callable,
	args ...goja.Value,
) (res goja.Value, err error)

RunAndWaitForResult can execute a goja function and wait for the result if the result is a promise, it will wait for the promise to resolve

Types

type ErrorHandlerFunc

type ErrorHandlerFunc func(*types.ModuleContext, error) error

func DefaultErrorHandlerFunction

func DefaultErrorHandlerFunction() ErrorHandlerFunc

func ExtractErrorHandlerFunction

func ExtractErrorHandlerFunction(
	loop *eventloop.EventLoop,
) (errorHandler ErrorHandlerFunc, err error)

type FetchUpstreamUrlFunc

type FetchUpstreamUrlFunc func(*types.ModuleContext) (*url.URL, error)

this can be used to create custom load balancing strategies, by default it uses round robin

func DefaultFetchUpstreamFunction

func DefaultFetchUpstreamFunction() FetchUpstreamUrlFunc

func ExtractFetchUpstreamFunction

func ExtractFetchUpstreamFunction(
	loop *eventloop.EventLoop,
) (fetchUpstream FetchUpstreamUrlFunc, err error)

const _ goja.AsyncContextTracker = ExtractorContextTracker{""}

type NoopPrinter

type NoopPrinter struct{}

func (*NoopPrinter) Error

func (p *NoopPrinter) Error(string)

func (*NoopPrinter) Log

func (p *NoopPrinter) Log(string)

func (*NoopPrinter) Warn

func (p *NoopPrinter) Warn(string)

type RequestHandlerFunc

type RequestHandlerFunc func(*types.ModuleContext) error

func ExtractRequestHandlerFunction

func ExtractRequestHandlerFunction(
	loop *eventloop.EventLoop,
) (requestHandler RequestHandlerFunc, err error)

type RequestModifierFunc

type RequestModifierFunc func(*types.ModuleContext) error

func ExtractRequestModifierFunction

func ExtractRequestModifierFunction(
	loop *eventloop.EventLoop,
) (requestModifier RequestModifierFunc, err error)

type ResponseModifierFunc

type ResponseModifierFunc func(*types.ModuleContext, *http.Response) error

func ExtractResponseModifierFunction

func ExtractResponseModifierFunction(
	loop *eventloop.EventLoop,
) (responseModifier ResponseModifierFunc, err error)

type Results

type Results struct {
	Result  goja.Value
	IsError bool
}

type RuntimeOptions

type RuntimeOptions struct {
	Env map[string]string
}

type TrackerEvent

type TrackerEvent int
const (
	Exited TrackerEvent = iota
	Resumed
)

Jump to

Keyboard shortcuts

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