MPA: move product hooks out of plugins environment (#21772)
* product: add new hooks manager for porducts * move product hooks out of plugins environment * add hooks for plugin
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9e79ca7160
Коммит
43e26ccda2
@@ -399,13 +399,13 @@ type {{.Name}}IFace interface {
|
||||
|
||||
{{end}}
|
||||
|
||||
type hooksAdapter struct {
|
||||
type HooksAdapter struct {
|
||||
implemented map[int]struct{}
|
||||
productHooks any
|
||||
}
|
||||
|
||||
func newAdapter(productHooks any) (*hooksAdapter, error) {
|
||||
a := &hooksAdapter{
|
||||
func NewAdapter(productHooks any) (*HooksAdapter, error) {
|
||||
a := &HooksAdapter{
|
||||
implemented: make(map[int]struct{}),
|
||||
productHooks: productHooks,
|
||||
}
|
||||
@@ -427,7 +427,7 @@ func newAdapter(productHooks any) (*hooksAdapter, error) {
|
||||
}
|
||||
|
||||
{{range .HooksMethods}}
|
||||
func (a *hooksAdapter) {{.Name}}{{funcStyle .Params}} {{funcStyle .Return}} {
|
||||
func (a *HooksAdapter) {{.Name}}{{funcStyle .Params}} {{funcStyle .Return}} {
|
||||
if _, ok := a.implemented[{{.Name}}ID]; !ok {
|
||||
panic("product hooks must implement {{.Name}}")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user