MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / loadResults

Method loadResults

ent/gitcommit_query.go:413–443  ·  view source on GitHub ↗
(ctx context.Context, query *CIWorkflowResultQuery, nodes []*GitCommit, init func(*GitCommit), assign func(*GitCommit, *CIWorkflowResult))

Source from the content-addressed store, hash-verified

411}
412
413func (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
445func (gcq *GitCommitQuery) sqlCount(ctx context.Context) (int, error) {
446 _spec := gcq.querySpec()

Callers 1

sqlAllMethod · 0.95

Calls 4

WhereMethod · 0.95
CIWorkflowResultFuncType · 0.92
initFunction · 0.70
AllMethod · 0.45

Tested by

no test coverage detected