Documentation
¶
Overview ¶
Package plugin defines the hook surfaces and the ordered registry.
v1 plugins are compile-time: a plugin is any Go type implementing one or more of the hook interfaces below, registered via Register (built-ins) or pdbq.WithPlugins (library embedding). The interfaces are deliberately small and orthogonal — they are also the contract for a future out-of-process (go-plugin / wasm) transport.
Index ¶
- func Register(p Plugin)
- type CatalogHook
- type CompileHook
- type InflectionHook
- type Plugin
- type Registry
- func (r *Registry) Add(p Plugin)
- func (r *Registry) All() []Plugin
- func (r *Registry) CompileChain(disabled map[string]bool, base compile.Func) compile.Func
- func (r *Registry) Enabled(disabled map[string]bool) []Plugin
- func (r *Registry) Inflector(disabled map[string]bool) inflect.Next
- func (r *Registry) RequestHooks(disabled map[string]bool) []RequestHook
- func (r *Registry) TransformCatalog(ctx context.Context, disabled map[string]bool, c *introspect.Catalog) error
- func (r *Registry) TransformSchema(ctx context.Context, disabled map[string]bool, b *schema.Builder) error
- type RequestHook
- type SchemaHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CatalogHook ¶
type CatalogHook interface {
TransformCatalog(ctx context.Context, c *introspect.Catalog) error
}
CatalogHook mutates or filters the introspected catalog before schema building (e.g. hide tables, rename via comments).
type CompileHook ¶
CompileHook wraps SQL generation per field, middleware-style.
type InflectionHook ¶
type InflectionHook interface {
Inflect(kind inflect.Kind, in inflect.Input, next inflect.Next) string
}
InflectionHook controls every generated GraphQL name. Call next to get the downstream (ultimately default) name; return your own to override.
type Plugin ¶
Plugin is the base interface: identity plus default priority. Lower priority runs earlier (outermost in middleware chains); ties break by registration order.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds plugins in deterministic order.
func NewRegistry ¶
func (*Registry) CompileChain ¶
CompileChain wraps base with all CompileHooks (outermost = lowest priority).
func (*Registry) Enabled ¶
Enabled returns plugins in execution order, excluding names disabled in cfg.
func (*Registry) Inflector ¶
Inflector composes all InflectionHooks into a single naming function with inflect.Default as the innermost link.
func (*Registry) RequestHooks ¶
func (r *Registry) RequestHooks(disabled map[string]bool) []RequestHook
RequestHooks returns the RequestHook implementations in order.
func (*Registry) TransformCatalog ¶
func (r *Registry) TransformCatalog(ctx context.Context, disabled map[string]bool, c *introspect.Catalog) error
TransformCatalog runs all CatalogHooks in order.