plugin

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: AGPL-3.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout The Context default timeout one minute.
	DefaultTimeout = time.Minute
)

Variables

This section is empty.

Functions

func GetAll

func GetAll() []*ext.Extension

GetAll returns all plugins.

func LoadPlugin

func LoadPlugin(dir string) []error

Types

type Context

type Context struct {
	context.Context // set to non-nil by the first cancel call
	// contains filtered or unexported fields
}

Context The Parser context

func NewContext

func NewContext(opt ContextOptions) *Context

NewContext creates a new Context with ContextOptions

func (*Context) BaseURL

func (c *Context) BaseURL() string

BaseURL returns the baseURL string

func (*Context) Cancel

func (c *Context) Cancel()

Cancel this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.

func (*Context) ClearValue

func (c *Context) ClearValue()

ClearValue clean all values

func (*Context) GetValue

func (c *Context) GetValue(key any) (any, bool)

GetValue returns the value associated with this context for key, or nil if no value is associated with key. Successive calls to Value with the same key returns the same result.

func (*Context) Logger

func (c *Context) Logger() *slog.Logger

Logger returns the logger, if ContextOptions.Logger is nil return slog.Default

func (*Context) SetValue

func (c *Context) SetValue(key any, value any)

SetValue value associated with key is val.

func (*Context) URL

func (c *Context) URL() string

URL returns the absolute URL string

func (*Context) Value

func (c *Context) Value(key any) any

Value returns the value associated with this context for key, or nil if no value is associated with key. Successive calls to Value with the same key returns the same result.

type ContextOptions added in v0.4.0

type ContextOptions struct {
	Parent  context.Context
	Timeout time.Duration
	Logger  *slog.Logger
	URL     string
}

ContextOptions The Context options

Directories

Path Synopsis
internal
ext
Package ext the extension manager
Package ext the extension manager
Package jsmodule the JS module
Package jsmodule the JS module
Package parser the schema parser
Package parser the schema parser

Jump to

Keyboard shortcuts

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