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

Method sqlAll

ent/gitcommit_query.go:374–411  ·  view source on GitHub ↗
(ctx context.Context, hooks ...queryHook)

Source from the content-addressed store, hash-verified

372}
373
374func (gcq *GitCommitQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*GitCommit, error) {
375 var (
376 nodes = []*GitCommit{}
377 _spec = gcq.querySpec()
378 loadedTypes = [1]bool{
379 gcq.withResults != nil,
380 }
381 )
382 _spec.ScanValues = func(columns []string) ([]any, error) {
383 return (*GitCommit).scanValues(nil, columns)
384 }
385 _spec.Assign = func(columns []string, values []any) error {
386 node := &GitCommit{config: gcq.config}
387 nodes = append(nodes, node)
388 node.Edges.loadedTypes = loadedTypes
389 return node.assignValues(columns, values)
390 }
391 if len(gcq.modifiers) > 0 {
392 _spec.Modifiers = gcq.modifiers
393 }
394 for i := range hooks {
395 hooks[i](ctx, _spec)
396 }
397 if err := sqlgraph.QueryNodes(ctx, gcq.driver, _spec); err != nil {
398 return nil, err
399 }
400 if len(nodes) == 0 {
401 return nodes, nil
402 }
403 if query := gcq.withResults; query != nil {
404 if err := gcq.loadResults(ctx, query, nodes,
405 func(n *GitCommit) { n.Edges.Results = []*CIWorkflowResult{} },
406 func(n *GitCommit, e *CIWorkflowResult) { n.Edges.Results = append(n.Edges.Results, e) }); err != nil {
407 return nil, err
408 }
409 }
410 return nodes, nil
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))

Callers

nothing calls this directly

Calls 5

querySpecMethod · 0.95
assignValuesMethod · 0.95
loadResultsMethod · 0.95
scanValuesMethod · 0.45
QueryNodesMethod · 0.45

Tested by

no test coverage detected