plugin

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: AGPL-3.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout The Context default timeout
	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 {
	// contains filtered or unexported fields
}

Context The Parser context

func NewContext

func NewContext(opt Options) *Context

NewContext creates a new Context with Options

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) Deadline

func (c *Context) Deadline() (time.Time, bool)

Deadline returns the time when work done on behalf of this context should be canceled. Deadline returns ok==false when no deadline is set. Successive calls to Deadline return the same results.

func (*Context) Done

func (c *Context) Done() <-chan struct{}

Done returns a channel that's closed when work done on behalf of this context should be canceled. Done may return nil if this context can never be canceled. Successive calls to Done return the same value. The close of the Done channel may happen asynchronously, after the cancel function returns.

func (*Context) Err

func (c *Context) Err() error

Err If Done is not yet closed, Err returns nil. If Done is closed, Err returns a non-nil error explaining why: Canceled if the context was canceled or DeadlineExceeded if the context's deadline passed. After Err returns a non-nil error, successive calls to Err return the same error.

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 Options.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 Options

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

Options 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