logical context merged module approach

This commit is contained in:
Pedro Costa
2025-05-29 18:34:23 +01:00
parent 5fc3f84d32
commit 1ecbba8d6d
20 changed files with 856 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package db
import (
"context"
"management/internal/shared/hook"
)
type Model interface {
TableName() string
}
type ModelEvent[T Model] struct {
hook.Event
Tx Transaction
Context context.Context
Model *T
}
type ModelErrorEvent[T Model] struct {
Error error
ModelEvent[T]
}
func (e *ModelEvent[T]) Tags() []string {
if e.Model == nil {
return nil
}
return []string{(*e.Model).TableName()}
}