Add the event service
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user