Add the event service

This commit is contained in:
Achim Rohn
2025-11-16 19:54:42 +01:00
parent bcc5c7493d
commit 049fefed75
26 changed files with 2656 additions and 9 deletions
+12
View File
@@ -9,6 +9,18 @@ import (
"git.gorlug.de/code/ersteller/schema/ent"
)
// The EventFunc type is an adapter to allow the use of ordinary
// function as Event mutator.
type EventFunc func(context.Context, *ent.EventMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f EventFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.EventMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventMutation", m)
}
// The GeneralQueueFunc type is an adapter to allow the use of ordinary
// function as GeneralQueue mutator.
type GeneralQueueFunc func(context.Context, *ent.GeneralQueueMutation) (ent.Value, error)