1
0

update migrate

This commit is contained in:
2023-04-05 15:05:14 +09:00
parent 9573dc895f
commit 1d5cb2ad9f
87 changed files with 65302 additions and 622 deletions

View File

@ -3,9 +3,9 @@
package hook
import (
"api/ent"
"context"
"fmt"
"t/ent"
)
// The CardFunc type is an adapter to allow the use of ordinary
@ -32,6 +32,30 @@ func (f GroupFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GroupMutation", m)
}
// The MaFunc type is an adapter to allow the use of ordinary
// function as Ma mutator.
type MaFunc func(context.Context, *ent.MaMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f MaFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.MaMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MaMutation", m)
}
// The UeFunc type is an adapter to allow the use of ordinary
// function as Ue mutator.
type UeFunc func(context.Context, *ent.UeMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f UeFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.UeMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UeMutation", m)
}
// The UserFunc type is an adapter to allow the use of ordinary
// function as User mutator.
type UserFunc func(context.Context, *ent.UserMutation) (ent.Value, error)