-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathutils.go
More file actions
52 lines (40 loc) · 965 Bytes
/
utils.go
File metadata and controls
52 lines (40 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"context"
"golang.org/x/sync/errgroup"
"app/dal"
)
type PendingPatchCounts struct {
SubjectPatchCount int64
EpisodePatchCount int64
CharacterPatchCount int64
PersonPatchCount int64
}
func CountPendingPatch(ctx context.Context, q *dal.Queries) (PendingPatchCounts, error) {
var counts PendingPatchCounts
g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
var err error
counts.SubjectPatchCount, err = q.CountPendingSubjectPatch(ctx)
return err
})
g.Go(func() error {
var err error
counts.EpisodePatchCount, err = q.CountPendingEpisodePatch(ctx)
return err
})
g.Go(func() error {
var err error
counts.CharacterPatchCount, err = q.CountPendingCharacterPatch(ctx)
return err
})
g.Go(func() error {
var err error
counts.PersonPatchCount, err = q.CountPendingPersonPatch(ctx)
return err
})
if err := g.Wait(); err != nil {
return PendingPatchCounts{}, err
}
return counts, nil
}