Documentation
¶
Overview ¶
Package plugin defines the transport-neutral hook surfaces and the ordered registry. Products wrap Registry and add their own typed hooks (schema/API, compile, request); the catalog and inflection hooks live here because they only depend on introspect and inflect.
Index ¶
- type CatalogHook
- type InflectionHook
- type Plugin
- type Registry
- func (r *Registry) Add(p Plugin)
- func (r *Registry) All() []Plugin
- func (r *Registry) Enabled(disabled map[string]bool) []Plugin
- func (r *Registry) Inflector(disabled map[string]bool, base inflect.Next) inflect.Next
- func (r *Registry) TransformCatalog(ctx context.Context, disabled map[string]bool, c *introspect.Catalog) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogHook ¶
type CatalogHook interface {
TransformCatalog(ctx context.Context, c *introspect.Catalog) error
}
CatalogHook mutates or filters the introspected catalog before API building (e.g. hide tables, rename via comments).
type InflectionHook ¶
type InflectionHook interface {
Inflect(kind inflect.Kind, in inflect.Input, next inflect.Next) string
}
InflectionHook controls every generated 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 ¶
NewRegistry builds a registry with the given plugins added in order.
func (*Registry) Inflector ¶
Inflector composes all InflectionHooks into a single naming function with base (the product's default inflector) as the innermost link.
func (*Registry) TransformCatalog ¶
func (r *Registry) TransformCatalog(ctx context.Context, disabled map[string]bool, c *introspect.Catalog) error
TransformCatalog runs all CatalogHooks in order.