mirror of
https://github.com/versia-pub/versia-go.git
synced 2026-03-13 12:39:15 +01:00
refactor!: working WD-4 user discovery
This commit is contained in:
parent
cf0053312d
commit
61891d891a
91 changed files with 12768 additions and 5562 deletions
|
|
@ -45,6 +45,18 @@ func (f ImageFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error
|
|||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ImageMutation", m)
|
||||
}
|
||||
|
||||
// The InstanceMetadataFunc type is an adapter to allow the use of ordinary
|
||||
// function as InstanceMetadata mutator.
|
||||
type InstanceMetadataFunc func(context.Context, *ent.InstanceMetadataMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f InstanceMetadataFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.InstanceMetadataMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.InstanceMetadataMutation", m)
|
||||
}
|
||||
|
||||
// The NoteFunc type is an adapter to allow the use of ordinary
|
||||
// function as Note mutator.
|
||||
type NoteFunc func(context.Context, *ent.NoteMutation) (ent.Value, error)
|
||||
|
|
@ -57,18 +69,6 @@ func (f NoteFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)
|
|||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.NoteMutation", m)
|
||||
}
|
||||
|
||||
// The ServerMetadataFunc type is an adapter to allow the use of ordinary
|
||||
// function as ServerMetadata mutator.
|
||||
type ServerMetadataFunc func(context.Context, *ent.ServerMetadataMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f ServerMetadataFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.ServerMetadataMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ServerMetadataMutation", 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue