Documentation
¶
Index ¶
- Variables
- type AccessPath
- type Config
- type EvalResult
- type HoverResult
- type InspectResult
- type LoginFunc
- type NextPageFunc
- type PageIterator
- func (i *PageIterator[T]) Filter(block func(each T) bool) (list []T)
- func (i *PageIterator[T]) GetIndex(idx int) T
- func (i *PageIterator[T]) HasNextPage() bool
- func (i *PageIterator[T]) Len() int
- func (i *PageIterator[T]) Map(block func(each T) any) (list []any)
- func (i *PageIterator[T]) NextPage() []T
- func (i *PageIterator[T]) ToProxy(vm *goja.Runtime) goja.Proxy
- type PagingState
- func (p PagingState) Err() error
- func (p PagingState) NextPageIndex() int
- func (p PagingState) NextPageToken() string
- func (p PagingState) WithError(err error) PagingState
- func (p PagingState) WithNextPageToken(token string) PagingState
- func (p PagingState) WithPageIndex(index int, done bool) PagingState
- type Plugin
- type PluginContext
- type PrintFunc
- type ProgramContext
- type RuntimeSetupFunc
Constants ¶
This section is empty.
Variables ¶
var Debug = false
Debug can be set on startup or by REPL command ":d"
var NoOutputValue = struct{}{}
NoOutputValue is a value to return from a function to prevent output.
var NoOutputValueString = "__NoOutputValueString"
Functions ¶
This section is empty.
Types ¶
type AccessPath ¶ added in v0.11.0
type AccessPath struct {
Expression string
}
type Config ¶
type Config struct { // Optional for initialization StartupScript string // Optional for command line mode RunScript string // Optional for remote client mode RemoteClient bool // Required for CORS Origin string // Optional when running as a service HttpAddr string // To configure custom plugins Plugins []Plugin // If set then this function is called on Start after all plugins are started Setup RuntimeSetupFunc // If set then this function is installed on the webserver to handle requests on "/" ( /v1 is used ) HttpHandler http.Handler }
type EvalResult ¶
type HoverResult ¶
type InspectResult ¶
type LoginFunc ¶ added in v0.14.0
LoginFunc is used to call on the plugin when the user is providing credentials.
type NextPageFunc ¶
type NextPageFunc[T any] func(input PagingState) ([]T, PagingState)
NextPageFunc fetches the next chunk of data (a page) and return the result with information about the next chunk (page).
type PageIterator ¶
type PageIterator[T any] struct { State PagingState // contains filtered or unexported fields }
func NewPagingIterator ¶
func NewPagingIterator[T any](nexter NextPageFunc[T]) *PageIterator[T]
NewPagingIterator returns an iterator that uses a paging function get chunks of data.
func (*PageIterator[T]) Filter ¶
func (i *PageIterator[T]) Filter(block func(each T) bool) (list []T)
Filter implements JS filter function
func (*PageIterator[T]) GetIndex ¶
func (i *PageIterator[T]) GetIndex(idx int) T
func (*PageIterator[T]) HasNextPage ¶
func (i *PageIterator[T]) HasNextPage() bool
func (*PageIterator[T]) Len ¶
func (i *PageIterator[T]) Len() int
func (*PageIterator[T]) Map ¶
func (i *PageIterator[T]) Map(block func(each T) any) (list []any)
Map implements JS map function
func (*PageIterator[T]) NextPage ¶
func (i *PageIterator[T]) NextPage() []T
type PagingState ¶
type PagingState struct {
// contains filtered or unexported fields
}
func (PagingState) Err ¶
func (p PagingState) Err() error
func (PagingState) NextPageIndex ¶
func (p PagingState) NextPageIndex() int
func (PagingState) NextPageToken ¶
func (p PagingState) NextPageToken() string
func (PagingState) WithError ¶
func (p PagingState) WithError(err error) PagingState
func (PagingState) WithNextPageToken ¶
func (p PagingState) WithNextPageToken(token string) PagingState
func (PagingState) WithPageIndex ¶
func (p PagingState) WithPageIndex(index int, done bool) PagingState
type Plugin ¶
type Plugin interface { Namespace() string Init(ctx PluginContext) error }
Plugin is the required interface for plugins that expose Javascript functions to the runtime. Each exposed method will be available. Methods should return two values, the last being the optional error.
type PluginContext ¶ added in v0.12.0
type ProgramContext ¶ added in v0.19.0
type ProgramContext struct { }
func (ProgramContext) OnLogin ¶ added in v0.19.0
func (p ProgramContext) OnLogin(plugin Plugin, logincall LoginFunc)
OnLogin immediately askes for the credentials to setup the plugin
type RuntimeSetupFunc ¶
type RuntimeSetupFunc func(ctx PluginContext) error
RuntimeSetupFunc is the signature of the Setup callback.