(ctx context.Context, hooks ...queryHook)
| 367 | } |
| 368 | |
| 369 | func (_q *DecisionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Decision, error) { |
| 370 | var ( |
| 371 | nodes = []*Decision{} |
| 372 | _spec = _q.querySpec() |
| 373 | loadedTypes = [1]bool{ |
| 374 | _q.withOwner != nil, |
| 375 | } |
| 376 | ) |
| 377 | _spec.ScanValues = func(columns []string) ([]any, error) { |
| 378 | return (*Decision).scanValues(nil, columns) |
| 379 | } |
| 380 | _spec.Assign = func(columns []string, values []any) error { |
| 381 | node := &Decision{config: _q.config} |
| 382 | nodes = append(nodes, node) |
| 383 | node.Edges.loadedTypes = loadedTypes |
| 384 | return node.assignValues(columns, values) |
| 385 | } |
| 386 | for i := range hooks { |
| 387 | hooks[i](ctx, _spec) |
| 388 | } |
| 389 | if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { |
| 390 | return nil, err |
| 391 | } |
| 392 | if len(nodes) == 0 { |
| 393 | return nodes, nil |
| 394 | } |
| 395 | if query := _q.withOwner; query != nil { |
| 396 | if err := _q.loadOwner(ctx, query, nodes, nil, |
| 397 | func(n *Decision, e *Alert) { n.Edges.Owner = e }); err != nil { |
| 398 | return nil, err |
| 399 | } |
| 400 | } |
| 401 | return nodes, nil |
| 402 | } |
| 403 | |
| 404 | func (_q *DecisionQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Decision, init func(*Decision), assign func(*Decision, *Alert)) error { |
| 405 | ids := make([]int, 0, len(nodes)) |
nothing calls this directly
no test coverage detected