plugin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin added in v0.7.0

func RegisterPlugin(typ Type, name string, fn func() Plugin)

Types

type BasePlugin added in v0.7.0

type BasePlugin[T Configuration] struct {
	Config T
}

func (*BasePlugin[T]) ExecuteInbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteInbound(c *Context) error

func (*BasePlugin[T]) ExecuteOutbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteOutbound(c *Context) error

func (*BasePlugin[T]) GetConfig added in v1.0.0

func (p *BasePlugin[T]) GetConfig() map[string]interface{}

func (*BasePlugin[T]) Init added in v1.0.0

func (p *BasePlugin[T]) Init(config map[string]interface{}) error

func (*BasePlugin[T]) Priority added in v1.0.0

func (p *BasePlugin[T]) Priority() int

func (*BasePlugin[T]) ValidateConfig added in v1.0.0

func (p *BasePlugin[T]) ValidateConfig(config map[string]interface{}) error

type Configuration added in v1.0.0

type Configuration interface {
	Schema() *openapi3.Schema
}

Configuration plugin configuration

type Context added in v0.7.0

type Context struct {
	Request *http.Request
	// contains filtered or unexported fields
}

func NewContext added in v1.0.1

func NewContext(ctx context.Context, r *http.Request, w http.ResponseWriter) *Context

func (*Context) Context added in v1.0.1

func (c *Context) Context() context.Context

func (*Context) GetRequestBody added in v1.0.1

func (c *Context) GetRequestBody() []byte

func (*Context) IsTerminated added in v1.0.1

func (c *Context) IsTerminated() bool

func (*Context) JSON added in v1.0.1

func (c *Context) JSON(code int, obj interface{})

func (*Context) Response added in v1.0.1

func (c *Context) Response(headers map[string]string, code int, body []byte)

func (*Context) SetRequestBody added in v1.0.1

func (c *Context) SetRequestBody(body []byte)

func (*Context) WithContext added in v1.0.1

func (c *Context) WithContext(ctx context.Context) *Context

type Plugin added in v0.7.0

type Plugin interface {
	// Name returns plugin's name
	Name() string

	// Priority returns plugin's priority
	Priority() int

	// Init inits plugin with configuration
	Init(config map[string]interface{}) error

	// GetConfig returns plugin's configuration
	GetConfig() map[string]interface{}

	// ValidateConfig validates plugin's configuration
	ValidateConfig(config map[string]interface{}) error

	// ExecuteInbound executes inbound
	ExecuteInbound(c *Context) error

	// ExecuteOutbound executes outbound
	ExecuteOutbound(c *Context) error
}

func New

func New(name string) (Plugin, bool)

type Registration added in v0.7.0

type Registration struct {
	Type    Type
	Factory func() Plugin
}

func GetRegistration added in v0.7.0

func GetRegistration(name string) *Registration

type Type added in v0.7.0

type Type string
const (
	TypeInbound  Type = "inbound"
	TypeOutbound Type = "outbound"
)

Jump to

Keyboard shortcuts

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