(ctx context.Context, query *CIWorkflowResultQuery, nodes []*GitCommit, init func(*GitCommit), assign func(*GitCommit, *CIWorkflowResult))
| 411 | } |
| 412 | |
| 413 | func (gcq *GitCommitQuery) loadResults(ctx context.Context, query *CIWorkflowResultQuery, nodes []*GitCommit, init func(*GitCommit), assign func(*GitCommit, *CIWorkflowResult)) error { |
| 414 | fks := make([]driver.Value, 0, len(nodes)) |
| 415 | nodeids := make(map[uuid.UUID]*GitCommit) |
| 416 | for i := range nodes { |
| 417 | fks = append(fks, nodes[i].ID) |
| 418 | nodeids[nodes[i].ID] = nodes[i] |
| 419 | if init != nil { |
| 420 | init(nodes[i]) |
| 421 | } |
| 422 | } |
| 423 | query.withFKs = true |
| 424 | query.Where(predicate.CIWorkflowResult(func(s *sql.Selector) { |
| 425 | s.Where(sql.InValues(s.C(gitcommit.ResultsColumn), fks...)) |
| 426 | })) |
| 427 | neighbors, err := query.All(ctx) |
| 428 | if err != nil { |
| 429 | return err |
| 430 | } |
| 431 | for _, n := range neighbors { |
| 432 | fk := n.git_commit_results |
| 433 | if fk == nil { |
| 434 | return fmt.Errorf(`foreign-key "git_commit_results" is nil for node %v`, n.ID) |
| 435 | } |
| 436 | node, ok := nodeids[*fk] |
| 437 | if !ok { |
| 438 | return fmt.Errorf(`unexpected referenced foreign-key "git_commit_results" returned %v for node %v`, *fk, n.ID) |
| 439 | } |
| 440 | assign(node, n) |
| 441 | } |
| 442 | return nil |
| 443 | } |
| 444 | |
| 445 | func (gcq *GitCommitQuery) sqlCount(ctx context.Context) (int, error) { |
| 446 | _spec := gcq.querySpec() |
no test coverage detected