[FEATURE] Detailed stats about player weapon usage and hitgroups (#1)
Reviewed-on: https://git.harting.dev/CSGOWTF/csgowtfd/pulls/1 Co-authored-by: Giovanni Harting <539@idlegandalf.com> Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
@@ -47,6 +47,19 @@ func (f StatsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error
|
||||
return f(ctx, mv)
|
||||
}
|
||||
|
||||
// The WeaponStatsFunc type is an adapter to allow the use of ordinary
|
||||
// function as WeaponStats mutator.
|
||||
type WeaponStatsFunc func(context.Context, *ent.WeaponStatsMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f WeaponStatsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.WeaponStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WeaponStatsMutation", m)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
type Condition func(context.Context, ent.Mutation) bool
|
||||
|
||||
|
Reference in New Issue
Block a user