(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int)
| 19 | } |
| 20 | |
| 21 | func (bugResolver) Comments(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.BugCommentConnection, error) { |
| 22 | input := models.ConnectionInput{ |
| 23 | Before: before, |
| 24 | After: after, |
| 25 | First: first, |
| 26 | Last: last, |
| 27 | } |
| 28 | |
| 29 | edger := func(comment bug.Comment, offset int) connections.Edge { |
| 30 | return models.BugCommentEdge{ |
| 31 | Node: &comment, |
| 32 | Cursor: connections.OffsetToCursor(offset), |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | conMaker := func(edges []*models.BugCommentEdge, nodes []bug.Comment, info *models.PageInfo, totalCount int) (*models.BugCommentConnection, error) { |
| 37 | var commentNodes []*bug.Comment |
| 38 | for _, c := range nodes { |
| 39 | commentNodes = append(commentNodes, &c) |
| 40 | } |
| 41 | return &models.BugCommentConnection{ |
| 42 | Edges: edges, |
| 43 | Nodes: commentNodes, |
| 44 | PageInfo: info, |
| 45 | TotalCount: totalCount, |
| 46 | }, nil |
| 47 | } |
| 48 | |
| 49 | comments, err := obj.Comments() |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | return connections.Connection(comments, edger, conMaker, input) |
| 55 | } |
| 56 | |
| 57 | func (bugResolver) Operations(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.OperationConnection, error) { |
| 58 | input := models.ConnectionInput{ |
nothing calls this directly
no test coverage detected