dep upgrade, regenerate
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package hook
|
||||
|
||||
@ -15,11 +15,10 @@ type AccountFunc func(context.Context, *ent.AccountMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AccountFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AccountMutation", m)
|
||||
if mv, ok := m.(*ent.AccountMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AccountMutation", m)
|
||||
}
|
||||
|
||||
// The AliasFunc type is an adapter to allow the use of ordinary
|
||||
@ -28,11 +27,10 @@ type AliasFunc func(context.Context, *ent.AliasMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AliasFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AliasMutation", m)
|
||||
if mv, ok := m.(*ent.AliasMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AliasMutation", m)
|
||||
}
|
||||
|
||||
// The DomainFunc type is an adapter to allow the use of ordinary
|
||||
@ -41,11 +39,10 @@ type DomainFunc func(context.Context, *ent.DomainMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f DomainFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DomainMutation", m)
|
||||
if mv, ok := m.(*ent.DomainMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DomainMutation", m)
|
||||
}
|
||||
|
||||
// The LogentryFunc type is an adapter to allow the use of ordinary
|
||||
@ -54,11 +51,10 @@ type LogentryFunc func(context.Context, *ent.LogentryMutation) (ent.Value, error
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f LogentryFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LogentryMutation", m)
|
||||
if mv, ok := m.(*ent.LogentryMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LogentryMutation", m)
|
||||
}
|
||||
|
||||
// The MailboxFunc type is an adapter to allow the use of ordinary
|
||||
@ -67,11 +63,10 @@ type MailboxFunc func(context.Context, *ent.MailboxMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f MailboxFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MailboxMutation", m)
|
||||
if mv, ok := m.(*ent.MailboxMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MailboxMutation", m)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
@ -169,7 +164,6 @@ func HasFields(field string, fields ...string) Condition {
|
||||
// If executes the given hook under condition.
|
||||
//
|
||||
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
|
||||
//
|
||||
func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
return func(next ent.Mutator) ent.Mutator {
|
||||
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
@ -184,7 +178,6 @@ func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
// On executes the given hook only for the given operation.
|
||||
//
|
||||
// hook.On(Log, ent.Delete|ent.Create)
|
||||
//
|
||||
func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, HasOp(op))
|
||||
}
|
||||
@ -192,7 +185,6 @@ func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
// Unless skips the given hook only for the given operation.
|
||||
//
|
||||
// hook.Unless(Log, ent.Update|ent.UpdateOne)
|
||||
//
|
||||
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, Not(HasOp(op)))
|
||||
}
|
||||
@ -213,7 +205,6 @@ func FixedError(err error) ent.Hook {
|
||||
// Reject(ent.Delete|ent.Update),
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func Reject(op ent.Op) ent.Hook {
|
||||
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
|
||||
return On(hk, op)
|
||||
|
Reference in New Issue
Block a user